npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

ace-linters

v1.2.0

Published

Ace linters is lsp client for Ace editor. It comes with large number of preconfigured easy to use in browser servers.

Downloads

9,045

Readme

Ace Linters (Ace Language Client)

Ace linters is lsp client for Ace editor. It comes with large number of preconfigured easy to use in browser servers.

If you're uncertain about integrating ace-linters, consult our diagram on the GitHub Wiki for a quick setup guide tailored to your needs.

Example client with pre-defined services:

import * as ace from "ace-code";
import {Mode as TypescriptMode} from "ace-code/src/mode/typescript";
import {LanguageProvider} from "ace-linters/build/ace-linters";

// Create a web worker
let worker = new Worker(new URL('./webworker.js', import.meta.url));

// Create an Ace editor
let editor = ace.edit("container", {
  mode: new TypescriptMode() // Set the mode of the editor to Typescript
});

// Create a language provider for web worker (
let languageProvider = LanguageProvider.create(worker);

// Register the editor with the language provider
languageProvider.registerEditor(editor);

Example webworker.js with all services

New Features in 1.2.0

  • add setProviderOptions method to LanguageProvider to set options for client.
  • add experimental semantic tokens support (turned off by default). To turn on semantic tokens, set semanticTokens to true in setProviderOptions method or use it in create or fromCdn methods like that
LanguageProvider.create(worker, {functionality: {semanticTokens: true}})

New Features in 1.0.0

  • registerServer method in ServiceManager enables management of both services and servers on the web worker's side. Just add new servers to your webworker like this:
    manager.registerServer("astro", {
        module: () => import("ace-linters/build/language-client"),
        modes: "astro",
        type: "socket", // "socket|worker"
        socket: new WebSocket("ws://127.0.0.1:3030/astro"),
        initializationOptions: {
            typescript: {
                tsdk: "node_modules/typescript/lib"
            }
        }
    });
  • Multiple servers management on main thread. Just register servers like this:
    let servers = [
        {
            module: () => import("ace-linters/build/language-client"),
            modes: "astro",
            type: "socket",
            socket: new WebSocket("ws://127.0.0.1:3030/astro"),
        },
        {
            module: () => import("ace-linters/build/language-client"),
            modes: "svelte",
            type: "socket",
            socket: new WebSocket("ws://127.0.0.1:3030/svelte"),
        }
    ]
    let languageProvider = AceLanguageClient.for(servers);
  • Breaking change: AceLanguageClient.for interface was changed

Example using script tag from CDN

<script src="https://www.unpkg.com/ace-builds@latest/src-noconflict/ace.js"></script>
<script src="https://www.unpkg.com/ace-builds@latest/src-noconflict/ext-language_tools.js"></script>
<script src="https://www.unpkg.com/ace-linters@latest/build/ace-linters.js"></script>
<div id="editor" style="height: 100px">some text</div>

<script>
  ace.require("ace/ext/language_tools"); //To allow autocompletion
  var CssMode = ace.require("ace/mode/css").Mode;
  var editor = ace.edit("editor", {
    enableBasicAutocompletion: true,
    enableLiveAutocompletion: true,
    mode: new CssMode()
  });

  var provider = LanguageProvider.fromCdn("https://www.unpkg.com/ace-linters@latest/build/");
  provider.registerEditor(editor);
</script>

Ace linters client currently supports two modes: WebSockets and WebWorkers.

Usage with WebSocket (JSON-RPC)

In WebSockets mode, you need to start a language server on any port and connect to it.

Here's an example client:

import * as ace from "ace-code";
import {Mode as JSONMode} from "ace-code/src/mode/json"; //any mode you want
import {AceLanguageClient} from "ace-linters/build/ace-language-client";

// Create a web socket
const serverData = {
  module: () => import("ace-linters/build/language-client"),
  modes: "json|json5",
  type: "socket",
  socket: new WebSocket("ws://127.0.0.1:3000/exampleServer"), // address of your websocket server
}
// Create an Ace editor
let editor = ace.edit("container", {
  mode: new JSONMode() // Set the mode of the editor to JSON
});

// Create a language provider for web socket
let languageProvider = AceLanguageClient.for(serverData);

// Register the editor with the language provider
languageProvider.registerEditor(editor);

Full Example client

Full Example server

Usage with WebWorker (JSON-RPC)

client.js:

import * as ace from "ace-code";
import {Mode as TypescriptMode} from "ace-code/src/mode/typescript";
import {AceLanguageClient} from "ace-linters/build/ace-language-client";

// Create a web worker
let worker = new Worker(new URL('./webworker.js', import.meta.url));
const serverData = {
  module: () => import("ace-linters/build/language-client"),
  modes: "json",
  type: "webworker",
  worker: worker,
}

// Create an Ace editor
let editor = ace.edit("container", {
  mode: new TypescriptMode() // Set the mode of the editor to Typescript
});

// Create a language provider for web worker
let languageProvider = AceLanguageClient.for(serverData);

// Register the editor with the language provider
languageProvider.registerEditor(editor);

Example client

[!] You need to describe server similar to that example: Example server

Supported LSP capabilities:

  • Text Document Synchronization (with incremental changes)
  • Hover
  • Diagnostics
  • Formatting
  • Completions
  • Signature Help

Full list of capabilities

Supported languages

Ace linters supports the following languages by default with webworkers approach:

Supported languages via extensions

  • MySQL, FlinkSQL, SparkSQL, HiveSQL, TrinoSQL, PostgreSQL, Impala SQL, PL/SQL with ace-sql-linter

Installation

To install Ace linters, you can use the following command:

npm install ace-linters

License

Ace linters is released under the MIT License.