about summary refs log tree commit diff
path: root/docs/dev
diff options
context:
space:
mode:
authoralcroito <placinta@gmail.com>2021-02-23 14:03:31 +0200
committeralcroito <placinta@gmail.com>2021-05-18 00:40:30 +0200
commit1f7d2a6c2297de4dedfb42b739e880ad2dd7d5d5 (patch)
tree46f7897cceaac302c0930dcdae99593e795b1351 /docs/dev
parentc04eaa1f37f31d7125372ba14da3d5059297e8b2 (diff)
downloadrust-1f7d2a6c2297de4dedfb42b739e880ad2dd7d5d5.tar.gz
rust-1f7d2a6c2297de4dedfb42b739e880ad2dd7d5d5.zip
Add new LSP extension for workspace symbol lookup
The new extension allows filtering of workspace symbool lookup
results by search scope or search kind.

Filtering can be configured in 3 different ways:

 - The '#' or '*' markers can be added inline with the symbol lookup
   query.

   The '#' marker means symbols should be looked up in the current
   workspace and any dependencies. If not specified, only current
   workspace is considered.

   The '*' marker means all kinds of symbols should be looked up
   (types, functions, etc). If not specified, only type symbols are
   returned.

 - Each LSP request can take an optional search_scope or search_kind
   argument query parameter.

 - Finally there are 2 global config options that can be set for all
   requests served by the active RA instance.

Add support for setting the global config options to the VSCode
extension.
The extension does not use the per-request way, but it's useful for
other IDEs.

The latest version of VSCode filters out the inline markers, so
currently the only reasonable way to use the new functionality is
via the global config.
Diffstat (limited to 'docs/dev')
-rw-r--r--docs/dev/lsp-extensions.md32
1 files changed, 31 insertions, 1 deletions
diff --git a/docs/dev/lsp-extensions.md b/docs/dev/lsp-extensions.md
index 8fcd72d5d5d..2d3787d0fe0 100644
--- a/docs/dev/lsp-extensions.md
+++ b/docs/dev/lsp-extensions.md
@@ -1,5 +1,5 @@
 <!---
-lsp_ext.rs hash: 6e57fc1b345b00e9
+lsp_ext.rs hash: 10a8988e6893e6b2
 
 If you need to change the above hash to make the test pass, please check if you
 need to adjust this doc as well and ping this issue:
@@ -650,3 +650,33 @@ export const enum Direction {
     Down = "Down"
 }
 ```
+
+## Lookup workspace symbol search scope and kind
+
+**Issue:** https://github.com/rust-analyzer/rust-analyzer/pull/7698
+
+This request is sent from client to server to search for workspace symbols filtered by an
+optional search scope and / or an optional symbol kind.
+
+**Method:** `workspace/symbol`
+
+**Request:** `WorkspaceSymbolParams`
+
+**Response:** `SymbolInformation[] | null`
+
+```typescript
+interface lsp_ext.WorkspaceSymbolParams extends WorkspaceSymbolParams {
+    searchScope?: WorkspaceSymbolSearchScope;
+    searchKind?: WorkspaceSymbolSearchKind;
+}
+
+const enum WorkspaceSymbolSearchScope {
+    Workspace = "Workspace",
+    WorkspaceAndDependencies = "WorkspaceAndDependencies"
+}
+
+const enum WorkspaceSymbolSearchKind {
+    OnlyTypes = "OnlyTypes",
+    AllSymbols = "AllSymbols"
+}
+```