1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-11-26 16:09:27 -05:00
denoland-deno/cli/lsp
Aaron O'Mullan 89057529bc
clean(cli): prefix all op functions with op_ (#10463)
Makes the codebase more searchable and helps distinguish op functions from helper functions

Besides tests/examples/benches this pattern appears to be used everywhere else in the codebase
2021-05-02 08:29:19 -04:00
..
analysis.rs remove macro_use (#9884) 2021-03-26 12:34:25 -04:00
capabilities.rs feat(lsp): Implement textDocument/documentSymbol (#9981) 2021-04-20 11:29:27 +10:00
completions.rs fix(#10362): include range for export statements (#10369) 2021-04-26 06:59:18 +10:00
config.rs feat(lsp): add registry import auto-complete (#9934) 2021-04-09 11:27:27 +10:00
diagnostics.rs remove macro_use (#9884) 2021-03-26 12:34:25 -04:00
documents.rs fix(#10125): remove documents when closed in the lsp (#10254) 2021-04-20 07:11:23 +10:00
language_server.rs Use ubuntu-latest-xl on more CI jobs (#10322) 2021-04-23 12:11:23 -04:00
mod.rs feat(lsp): Implement textDocument/semanticTokens/full (#10233) 2021-04-20 11:26:36 +10:00
path_to_regex.rs feat(lsp): add registry import auto-complete (#9934) 2021-04-09 11:27:27 +10:00
performance.rs feat(lsp): improve diagnostic status page (#10253) 2021-04-20 07:10:43 +10:00
README.md feat(lsp): add registry import auto-complete (#9934) 2021-04-09 11:27:27 +10:00
registries.rs chore(cli/lsp): fix 2 lint errors (#10228) 2021-04-18 15:29:37 +10:00
semantic_tokens.rs feat(lsp): Implement textDocument/semanticTokens/full (#10233) 2021-04-20 11:26:36 +10:00
sources.rs fix(#10031): lsp handles x-typescript-types header on type only imports properly (#10261) 2021-04-20 22:22:22 +10:00
text.rs feat(lsp): Implement textDocument/semanticTokens/full (#10233) 2021-04-20 11:26:36 +10:00
tsc.rs clean(cli): prefix all op functions with op_ (#10463) 2021-05-02 08:29:19 -04:00
urls.rs refactor: use 'data-url' crate to process data URLs in lsp & file_fetcher (#10196) 2021-04-23 20:43:13 +02:00

Deno Language Server

The Deno Language Server provides a server implementation of the Language Server Protocol which is specifically tailored to provide a Deno view of code. It is integrated into the command line and can be started via the lsp sub-command.

⚠️ The Language Server is highly experimental and far from feature complete. This document gives an overview of the structure of the language server.

Structure

When the language server is started, a LanguageServer instance is created which holds all of the state of the language server. It also defines all of the methods that the client calls via the Language Server RPC protocol.

Custom requests

The LSP currently supports the following custom requests. A client should implement these in order to have a fully functioning client that integrates well with Deno:

  • deno/cache - This command will instruct Deno to attempt to cache a module and all of its dependencies. If a referrer only is passed, then all dependencies for the module specifier will be loaded. If there are values in the uris, then only those uris will be cached.

    It expects parameters of:

    interface CacheParams {
      referrer: TextDocumentIdentifier;
      uris: TextDocumentIdentifier[];
    }
    
  • deno/performance - Requests the return of the timing averages for the internal instrumentation of Deno.

    It does not expect any parameters.

  • deno/reloadImportRegistries - Reloads any cached responses from import registries.

    It does not expect any parameters.

  • deno/virtualTextDocument - Requests a virtual text document from the LSP, which is a read only document that can be displayed in the client. This allows clients to access documents in the Deno cache, like remote modules and TypeScript library files built into Deno. The Deno language server will encode all internal files under the custom schema deno:, so clients should route all requests for the deno: schema back to the deno/virtualTextDocument API.

    It also supports a special URL of deno:/status.md which provides a markdown formatted text document that contains details about the status of the LSP for display to a user.

    It expects parameters of:

    interface VirtualTextDocumentParams {
      textDocument: TextDocumentIdentifier;
    }