1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-11-25 15:29:32 -05:00
denoland-deno/cli/lsp
Bert Belder fb5a2786ec
refactor(lsp): slightly reorganize diagnostics debounce logic (#9796)
This patch doesn't actually fix the bug I was hoping to fix, which is
that `update_diagnostics()` sometimes gets called even when there are
more updates that should be processed first. I did eventually figure out
that this issue is caused by Tokio's cooperative yielding, which
currently can't be disabled.

However overall it makes the debounce code somewhat more readable IMO,
which is why I'm suggesting to land it anyway.
2021-03-18 21:26:41 +01:00
..
analysis.rs fix(lsp): handle data URLs properly (#9522) 2021-02-18 15:37:05 +11:00
capabilities.rs refactor(lsp): refactor completions and add tests (#9789) 2021-03-16 09:01:41 +11:00
config.rs refactor(lsp): refactor completions and add tests (#9789) 2021-03-16 09:01:41 +11:00
diagnostics.rs refactor(lsp): slightly reorganize diagnostics debounce logic (#9796) 2021-03-18 21:26:41 +01:00
documents.rs Make ModuleSpecifier a type alias, not wrapper struct (#9531) 2021-02-17 13:47:18 -05:00
language_server.rs refactor(lsp): refactor completions and add tests (#9789) 2021-03-16 09:01:41 +11:00
mod.rs fix(lsp): handle data URLs properly (#9522) 2021-02-18 15:37:05 +11:00
performance.rs feat(lsp): add deno cache code actions (#9471) 2021-02-12 15:17:48 +11:00
README.md fix(lsp): handle data URLs properly (#9522) 2021-02-18 15:37:05 +11:00
sources.rs fix(lsp): allow on disk files to change (#9746) 2021-03-10 21:39:16 +11:00
text.rs Update lspower dependency (#9179) 2021-01-29 14:34:33 -05:00
tsc.rs refactor(lsp): refactor completions and add tests (#9789) 2021-03-16 09:01:41 +11:00
urls.rs fix(lsp): handle data URLs properly (#9522) 2021-02-18 15:37:05 +11:00
utils.rs Make ModuleSpecifier a type alias, not wrapper struct (#9531) 2021-02-17 13:47:18 -05: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/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;
    }