From 0ebb25b29b0988be89f42091fd373ea58d7ff9fb Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Mon, 25 May 2020 15:55:25 +0200 Subject: Document `parentModule` experimental LSP request --- docs/dev/lsp-extensions.md | 40 +++++++++++++++++++++++++++++++++++----- 1 file changed, 35 insertions(+), 5 deletions(-) (limited to 'docs') diff --git a/docs/dev/lsp-extensions.md b/docs/dev/lsp-extensions.md index 48147b173..209f470eb 100644 --- a/docs/dev/lsp-extensions.md +++ b/docs/dev/lsp-extensions.md @@ -87,6 +87,40 @@ Invoking code action at this position will yield two code actions for importing * Is a fixed two-level structure enough? * Should we devise a general way to encode custom interaction protocols for GUI refactorings? +## Parent Module + +**Issue:** https://github.com/microsoft/language-server-protocol/issues/1002 + +**Server Capability:** `{ "parentModule": boolean }` + +This request is send from client to server to handle "Goto Parent Module" editor action. + +**Method:** `experimental/parentModule` + +**Request:** `TextDocumentPositionParams` + +**Response:** `Location | Location[] | LocationLink[] | null` + + +### Example + +```rust +// src/main.rs +mod foo; +// src/foo.rs + +/* cursor here*/ +``` + +`experimental/parentModule` returns a single `Link` to the `mod foo;` declaration. + +### Unresolved Question + +* An alternative would be to use a more general "gotoSuper" request, which would work for super methods, super classes and super modules. + This is the approach IntelliJ Rust is takeing. + However, experience shows that super module (which generally has a feeling of navigation between files) should be separate. + If you want super module, but the cursor happens to be inside an overriden function, the behavior with single "gotoSuper" request is surprising. + ## Join Lines **Issue:** https://github.com/microsoft/language-server-protocol/issues/992 @@ -108,11 +142,7 @@ interface JoinLinesParams { } ``` -**Response:** - -```typescript -TextEdit[] -``` +**Response:** `TextEdit[]` ### Example -- cgit v1.2.3