Language Server Overview

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.

Most users will never interact with the server directly, but instead will via vscode_deno or another editor extension . This documentation is for those implementing a editor client.

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.

Settings

There are several settings that the language server supports for a workspace:

There are settings that are supported on a per resource basis by the language server:

There are several points in the process where Deno analyzes these settings. First, when the initialize request from the client, the initializationOptions will be assumed to be an object that represents the deno namespace of options. For example, the following value:

{
  "enable": true,
  "unstable": true
}

Would enable Deno with the unstable APIs for this instance of the language server.

When the language server receives a workspace/didChangeConfiguration notification, it will assess if the client has indicated if it has a workspaceConfiguration capability. If it does, it will send a workspace/configuration request which will include a request for the workspace configuration as well as the configuration of all URIs that the language server is currently tracking.

If the client has the workspaceConfiguration capability, the language server will send a configuration request for the URI when it received the textDocument/didOpen notification in order to get the resources specific settings.

If the client does not have the workspaceConfiguration capability, the language server will assume the workspace setting applies to all resources.

Commands

There are several commands that might be issued by the language server to the client, which the client is expected to implement:

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:

Notifications

There is currently one custom notification that is sent from the server to the client:

Language IDs

The language server supports diagnostics and formatting for the following text document language IDs :

The language server supports only formatting for the following language IDs: