1.11.0 • Published 28 days ago

@shopify/theme-language-server-common v1.11.0

Weekly downloads
-
License
MIT
Repository
github
Last release
28 days ago

The Language Server Protocol empowers developers to provide code editing features to all code editors in a single code base with no code-editor-specific code.

This module serves as a runtime-agnostic Liquid Language Server so that we can also run it inside the Online Store Code Editor (via a CodeMirror Language Client).

You may be interested in the sibling modules:

Usage

This repo only contains the library over the functionality. The CLI is implemented in Shopify/cli.

Node

The Node.js version comes with batteries included and uses STDIN and STDOUT as the communication channel.

// slim-cli.ts
import { startServer } from '@shopify/theme-language-server-node';

// start the server (batteries included)
startServer();

Browser

The browser version accepts a Web Worker as argument.

// worker.ts
import { startServer, Dependencies } from '@shopify/theme-language-server-browser';

// Provide implementations for the dependency injections
const dependencies: Dependencies = { /* ... */ };

// In a Web Worker, the self object refers to the worker.
startServer(self as any as Worker, dependencies);

Learn more

  • Read the Language Server Protocol Spec

    It's important to understand the following concepts:

    • Language Client
    • Language Server
    • Messages
      • Requests / Response
      • Notifications
      • Message direction
    • Client Capabilities
    • Server Capabilities
    • TextDocument synchronization
    • Lifecycle methods
  • Take a look at the vscode-languageserver-* libraries offered by VS Code.

    They have vscode in their name, but only vscode-languageclient is VS Code specific, the other libraries can be used in non-VS Code contexts (we do this here).

    • vscode-languageserver-server

      This library provides the connection object and is runtime agnostic. The entire spec is implemented and thus you can hook into every message type.

      Examples: connection.onInitialize(params => {}), connection.onTextDocumentDidOpen(params => {}), etc.

    • vscode-languageserver-protocol

      This library is useful to reuse and type check message parameter types.

      Examples: PublishDiagnosticsNotification, DiagnosticClientCapabilities, DiagnosticServerCapabilities, etc.

    • vscode-languageserver-types

      This library is useful to get the types of specific parts of the Protocol.

      Examples: Diagnostic, URI, TextDocument, Position, Range, LocationLink, etc.

1.11.0

28 days ago

1.10.0

1 month ago

1.9.0

1 month ago

1.8.3

2 months ago

1.8.2

2 months ago

1.8.1

2 months ago

1.8.0

2 months ago

1.7.7

3 months ago

1.7.6

3 months ago

1.7.5

3 months ago

1.7.4

3 months ago

1.7.3

3 months ago

1.7.2

4 months ago

1.7.1

5 months ago

1.7.0

6 months ago

1.6.0

6 months ago

1.5.1

6 months ago

1.5.0

6 months ago

1.4.6

6 months ago

1.4.5

6 months ago

1.4.4

6 months ago

1.4.3

6 months ago

1.4.2

6 months ago

1.4.1

7 months ago

1.4.0

7 months ago

1.3.3

7 months ago

1.3.2

7 months ago

1.3.1

7 months ago

1.3.0

7 months ago

1.2.1

7 months ago

1.2.0

7 months ago

1.1.0

7 months ago

1.0.2

7 months ago

1.0.1

7 months ago

1.0.0

7 months ago