diff options
author | alcroito <[email protected]> | 2021-02-23 12:03:31 +0000 |
---|---|---|
committer | alcroito <[email protected]> | 2021-05-17 23:40:30 +0100 |
commit | 1f7d2a6c2297de4dedfb42b739e880ad2dd7d5d5 (patch) | |
tree | 46f7897cceaac302c0930dcdae99593e795b1351 /docs | |
parent | c04eaa1f37f31d7125372ba14da3d5059297e8b2 (diff) |
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')
-rw-r--r-- | docs/dev/lsp-extensions.md | 32 | ||||
-rw-r--r-- | docs/user/generated_config.adoc | 10 |
2 files changed, 41 insertions, 1 deletions
diff --git a/docs/dev/lsp-extensions.md b/docs/dev/lsp-extensions.md index 8fcd72d5d..2d3787d0f 100644 --- a/docs/dev/lsp-extensions.md +++ b/docs/dev/lsp-extensions.md | |||
@@ -1,5 +1,5 @@ | |||
1 | <!--- | 1 | <!--- |
2 | lsp_ext.rs hash: 6e57fc1b345b00e9 | 2 | lsp_ext.rs hash: 10a8988e6893e6b2 |
3 | 3 | ||
4 | If you need to change the above hash to make the test pass, please check if you | 4 | If you need to change the above hash to make the test pass, please check if you |
5 | need to adjust this doc as well and ping this issue: | 5 | need to adjust this doc as well and ping this issue: |
@@ -650,3 +650,33 @@ export const enum Direction { | |||
650 | Down = "Down" | 650 | Down = "Down" |
651 | } | 651 | } |
652 | ``` | 652 | ``` |
653 | |||
654 | ## Lookup workspace symbol search scope and kind | ||
655 | |||
656 | **Issue:** https://github.com/rust-analyzer/rust-analyzer/pull/7698 | ||
657 | |||
658 | This request is sent from client to server to search for workspace symbols filtered by an | ||
659 | optional search scope and / or an optional symbol kind. | ||
660 | |||
661 | **Method:** `workspace/symbol` | ||
662 | |||
663 | **Request:** `WorkspaceSymbolParams` | ||
664 | |||
665 | **Response:** `SymbolInformation[] | null` | ||
666 | |||
667 | ```typescript | ||
668 | interface lsp_ext.WorkspaceSymbolParams extends WorkspaceSymbolParams { | ||
669 | searchScope?: WorkspaceSymbolSearchScope; | ||
670 | searchKind?: WorkspaceSymbolSearchKind; | ||
671 | } | ||
672 | |||
673 | const enum WorkspaceSymbolSearchScope { | ||
674 | Workspace = "Workspace", | ||
675 | WorkspaceAndDependencies = "WorkspaceAndDependencies" | ||
676 | } | ||
677 | |||
678 | const enum WorkspaceSymbolSearchKind { | ||
679 | OnlyTypes = "OnlyTypes", | ||
680 | AllSymbols = "AllSymbols" | ||
681 | } | ||
682 | ``` | ||
diff --git a/docs/user/generated_config.adoc b/docs/user/generated_config.adoc index feba43ff1..b32411887 100644 --- a/docs/user/generated_config.adoc +++ b/docs/user/generated_config.adoc | |||
@@ -341,3 +341,13 @@ Additional arguments to `rustfmt`. | |||
341 | Advanced option, fully override the command rust-analyzer uses for | 341 | Advanced option, fully override the command rust-analyzer uses for |
342 | formatting. | 342 | formatting. |
343 | -- | 343 | -- |
344 | [[rust-analyzer.workspace.symbol.search.scope]]rust-analyzer.workspace.symbol.search.scope (default: `"workspace"`):: | ||
345 | + | ||
346 | -- | ||
347 | Workspace symbol search scope. | ||
348 | -- | ||
349 | [[rust-analyzer.workspace.symbol.search.kind]]rust-analyzer.workspace.symbol.search.kind (default: `"only_types"`):: | ||
350 | + | ||
351 | -- | ||
352 | Workspace symbol search kind. | ||
353 | -- | ||