Link Search Menu Expand Document

Language Services

  • A language service is a library that implements programmatic language features for a single language. A language server can embed language services to handle embedded languages.

Request Forwarding#

In a nutshell, request forwarding works in a similar way as language services. The request forwarding approach also takes language server requests, computes virtual content, and calculates the responses.

The major differences are:

  • While the language service approach uses libraries to calculate language server responses, request forwarding sends the request back to VS Code to query all language servers and forward their responses.
  • The dispatching happens in the language client, not the language server.

Summary

Language Service:

+ Full control of the language server and the user experience.
+ No dependencies on other language servers. All code is in one repository.
+ The language server can be reused in all LSP-compliant code editors.
- Might be hard to embed language services written in other languages.
- Needs continued maintenance to get new features from language service dependencies.

Request forwarding:

+ Avoid issues embedding language services not written in the language server's language (for example, embedding C# compiler in a Razor language server to support C#).
+ No maintenance needed to get new features upstream from other language services.
+ Does not work with diagnostics errors, which are pushed from Language server.
- Hard to share state to other language servers because of lack of control.
- Cross-language features might be hard to implement (for example, providing CSS completion for .foo when <div class="foo"> is present).

Copyright © 2020 Thence LLC