From a752853350639a915178ea900a51f3c45443795e Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Sun, 17 May 2020 21:24:33 +0200 Subject: Add snippetTextEdit protocol extension --- docs/dev/lsp-extensions.md | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 docs/dev/lsp-extensions.md (limited to 'docs/dev') diff --git a/docs/dev/lsp-extensions.md b/docs/dev/lsp-extensions.md new file mode 100644 index 000000000..d2ec6c021 --- /dev/null +++ b/docs/dev/lsp-extensions.md @@ -0,0 +1,34 @@ +# LSP Extensions + +This document describes LSP extensions used by rust-analyzer. +It's a best effort document, when in doubt, consult the source (and send a PR with clarification ;-) ). +We aim to upstream all non Rust-specific extensions to the protocol, but this is not a top priority. +All capabilities are enabled via `experimental` field of `ClientCapabilities`. + +## `SnippetTextEdit` + +**Capability** + +```typescript +{ + "snippetTextEdit": boolean +} +``` + +If this capability is set, `WorkspaceEdit`s returned from `codeAction` requests might contain `SnippetTextEdit`s instead of usual `TextEdit`s: + +```typescript +interface SnippetTextEdit extends TextEdit { + insertTextFormat?: InsertTextFormat; +} +``` + +```typescript +export interface TextDocumentEdit { + textDocument: VersionedTextDocumentIdentifier; + edits: (TextEdit | SnippetTextEdit)[]; +} +``` + +When applying such code action, the editor should insert snippet, with tab stops and placeholder. +At the moment, rust-analyzer guarantees that only a single edit will have `InsertTextFormat.Snippet`. -- cgit v1.2.3 From d58d6412d837a9f6475e04c74709d78f52c9ff6a Mon Sep 17 00:00:00 2001 From: Yuki Kodama Date: Thu, 21 May 2020 03:01:37 +0900 Subject: Fix names of launch configuration in dev docs --- docs/dev/README.md | 4 ++-- docs/dev/debugging.md | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) (limited to 'docs/dev') diff --git a/docs/dev/README.md b/docs/dev/README.md index a20ead0b6..65cc9fc12 100644 --- a/docs/dev/README.md +++ b/docs/dev/README.md @@ -74,7 +74,7 @@ relevant test and execute it (VS Code includes an action for running a single test). However, launching a VS Code instance with locally build language server is -possible. There's **"Run Extension (Dev Server)"** launch configuration for this. +possible. There's **"Run Extension (Debug Build)"** launch configuration for this. In general, I use one of the following workflows for fixing bugs and implementing features. @@ -86,7 +86,7 @@ then just do printf-driven development/debugging. As a sanity check after I'm done, I use `cargo xtask install --server` and **Reload Window** action in VS Code to sanity check that the thing works as I expect. -If the problem concerns only the VS Code extension, I use **Run Extension** +If the problem concerns only the VS Code extension, I use **Run Installed Extension** launch configuration from `launch.json`. Notably, this uses the usual `rust-analyzer` binary from `PATH`. For this it is important to have the following in `setting.json` file: diff --git a/docs/dev/debugging.md b/docs/dev/debugging.md index 1aa392935..59a83f7d7 100644 --- a/docs/dev/debugging.md +++ b/docs/dev/debugging.md @@ -22,8 +22,8 @@ where **only** the `rust-analyzer` extension being debugged is enabled. ## Debug TypeScript VSCode extension -- `Run Extension` - runs the extension with the globally installed `rust-analyzer` binary. -- `Run Extension (Dev Server)` - runs extension with the locally built LSP server (`target/debug/rust-analyzer`). +- `Run Installed Extension` - runs the extension with the globally installed `rust-analyzer` binary. +- `Run Extension (Debug Build)` - runs extension with the locally built LSP server (`target/debug/rust-analyzer`). TypeScript debugging is configured to watch your source edits and recompile. To apply changes to an already running debug process, press Ctrl+Shift+P and run the following command in your `[Extension Development Host]` @@ -47,7 +47,7 @@ To apply changes to an already running debug process, press Ctrl+Shift+P