The Sass language server uses the language server protocol (LSP). With LSP one language server can be used in any editor that has a language client which supports the language server protocol.
This repository has a language client for Visual Studio Code in the extension directory.
The language server is divided in two packages:
We have this split so the language server features are reusable for embedded languages where the embedder language server is also written in Dart.
This is the language server executable. Users will install this package, and the language client will run the server when needed.
This is where you find the core functionality of the language server. Individual features are in the lib/src/features/
directory. Each feature extends a base LanguageFeature
class.
When used, all features parse the given TextDocument
using sass_api
to get the Stylesheet
node. Parses are cached, along with other often-used information such as resolved links.
This is the language extension (containing the language client) for Visual Studio Code. The extension is set up to create one language client (and so run one language server) per workspace.
The language client uses the Socket transport to communicate with the language server. Perhaps confusingly, it is the language client which is the socket server. The language server then connects to the socket server that is running on the client.
If you are configuring a client for another editor you may want to use the --stdio
transport for ease of use. We use sockets in the Visual Studio Code extension since Dart's debug mode prints to stdout, which interferes with the language server output.