summaryrefslogtreecommitdiff
path: root/cli/lsp/README.md
diff options
context:
space:
mode:
authorKitson Kelly <me@kitsonkelly.com>2021-06-01 21:53:08 +1000
committerGitHub <noreply@github.com>2021-06-01 21:53:08 +1000
commitbb5bf91067e28cef869f5180dc73a9b86e368bdc (patch)
treeb32cf8ec12073f58bb0f5aa2672047485a582843 /cli/lsp/README.md
parent9abb899f5fd36da65aae78351df3f478f8363700 (diff)
feat(lsp): registry auto discovery (#10813)
Closes: #10194 Fixes: #10468
Diffstat (limited to 'cli/lsp/README.md')
-rw-r--r--cli/lsp/README.md125
1 files changed, 75 insertions, 50 deletions
diff --git a/cli/lsp/README.md b/cli/lsp/README.md
index d480e3133..28ae50c6a 100644
--- a/cli/lsp/README.md
+++ b/cli/lsp/README.md
@@ -5,9 +5,8 @@ The Deno Language Server provides a server implementation of the
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.
-> :warning: The Language Server is highly experimental and far from feature
-> complete. This document gives an overview of the structure of the language
-> server.
+> :warning: The Language Server is experimental and not feature complete. This
+> document gives an overview of the structure of the language server.
## Structure
@@ -15,6 +14,60 @@ 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:
+
+- `deno.enable`
+- `deno.config`
+- `deno.importMap`
+- `deno.codeLens.implementations`
+- `deno.codeLens.references`
+- `deno.codeLens.referencesAllFunctions`
+- `deno.suggest.completeFunctionCalls`
+- `deno.suggest.names`
+- `deno.suggest.paths`
+- `deno.suggest.autoImports`
+- `deno.suggest.imports.autoDiscover`
+- `deno.suggest.imports.hosts`
+- `deno.lint`
+- `deno.unstable`
+
+There are settings that are support on a per resource basis by the language
+server:
+
+- `deno.enable`
+
+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:
+
+```json
+{
+ "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.
+
## Custom requests
The LSP currently supports the following custom requests. A client should
@@ -62,55 +115,27 @@ with Deno:
}
```
-## Settings
-
-There are several settings that the language server supports for a workspace:
-
-- `deno.enable`
-- `deno.config`
-- `deno.import_map`
-- `deno.code_lens.implementations`
-- `deno.code_lens.references`
-- `deno.code_lens.references_all_functions`
-- `deno.suggest.complete_function_calls`
-- `deno.suggest.names`
-- `deno.suggest.paths`
-- `deno.suggest.auto_imports`
-- `deno.imports.hosts`
-- `deno.lint`
-- `deno.unstable`
-
-There are settings that are support on a per resource basis by the language
-server:
-
-- `deno.enable`
+## Custom notifications
-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:
-
-```json
-{
- "enable": true,
- "unstable": true
-}
-```
+There is currently one custom notification that is send from the server to the
+client:
-Would enable Deno with the unstable APIs for this instance of the language
-server.
+- `deno/registryStatus` - when `deno.suggest.imports.autoDiscover` is `true` and
+ an origin for an import being added to a document is not explicitly set in
+ `deno.suggest.imports.hosts`, the origin will be checked and the notification
+ will be sent to the client of the status.
-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.
+ When receiving the notification, if the param `suggestion` is `true`, the
+ client should offer the user the choice to enable the origin and add it to the
+ configuration for `deno.suggest.imports.hosts`. If `suggestion` is `false` the
+ client should add it to the configuration of as `false` to stop the language
+ server from attempting to detect if suggestions are supported.
-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.
+ The params for the notification are:
-If the client does not have the `workspaceConfiguration` capability, the
-language server will assume the workspace setting applies to all resources.
+ ```ts
+ interface RegistryStatusNotificationParams {
+ origin: string;
+ suggestions: boolean;
+ }
+ ```