Skip to content
This repository was archived by the owner on Nov 18, 2022. It is now read-only.

Commit 7919de1

Browse files
committed
Remove old rls.findImpls command
This was used before LSP has considered (and now stabilised) a 'go to implementation' request. Handling this via LSP, even at the cost of command disappearing from the context menu [1], is preferred than using a global command. We'd have to maintain an extra mapping and guess which RLS server is responsible for the file for which a request has been made. This is hacky and not guaranteed to be correct; meanwhile we get errors in multi-root workspaces whenever we open more than one folder due to each instance trying to register a global command under the same identifier. The clean solution is to remove this extra command and use the standard Go to Implementation (under Go > Go to Implementation [Ctrl + F12]) while we wait for the user configurable menus [2] to land. [1]: microsoft/vscode#54317 [2]: microsoft/vscode#9285
1 parent 2407b28 commit 7919de1

File tree

3 files changed

+0
-63
lines changed

3 files changed

+0
-63
lines changed

README.md

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -65,16 +65,6 @@ Some highlights:
6565

6666
## Features
6767

68-
### Commands
69-
70-
Commands can be found in the command palette <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>P</kbd>. We provide the
71-
following commands:
72-
73-
* `Find Implementations` - Find locations of `impl` blocks for traits, structs, and enums.
74-
Usefull to find all structs implementing a specific trait or all traits implemented for a struct.
75-
Select a type when running the command.
76-
77-
7868
### Snippets
7969

8070
Snippets are code templates which expand into common boilerplate. Intellisense

package.json

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -80,12 +80,6 @@
8080
}
8181
],
8282
"commands": [
83-
{
84-
"command": "rls.findImpls",
85-
"title": "Find Implementations",
86-
"description": "Show impl blocks for trait, struct, or enum",
87-
"category": "Rust"
88-
},
8983
{
9084
"command": "rls.update",
9185
"title": "Update the RLS",
@@ -99,15 +93,6 @@
9993
"category": "Rust"
10094
}
10195
],
102-
"menus": {
103-
"editor/context": [
104-
{
105-
"command": "rls.findImpls",
106-
"when": "editorLangId == rust && editorHasReferenceProvider",
107-
"group": "navigation@4"
108-
}
109-
]
110-
},
11196
"taskDefinitions": [
11297
{
11398
"type": "cargo",

src/extension.ts

Lines changed: 0 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -298,44 +298,6 @@ class ClientWorkspace {
298298
return;
299299
}
300300

301-
const findImplsDisposable = commands.registerTextEditorCommand(
302-
'rls.findImpls',
303-
async (textEditor: TextEditor, _edit: TextEditorEdit) => {
304-
if (!this.lc) {
305-
return;
306-
}
307-
await this.lc.onReady();
308-
// Prior to https://github.com/rust-lang-nursery/rls/pull/936 we used a custom
309-
// LSP message - if the implementation provider is specified this means we can use the 3.6 one.
310-
const useLSPRequest =
311-
this.lc.initializeResult &&
312-
this.lc.initializeResult.capabilities.implementationProvider === true;
313-
const request = useLSPRequest
314-
? ImplementationRequest.type.method
315-
: 'rustDocument/implementations';
316-
317-
const params = this.lc.code2ProtocolConverter.asTextDocumentPositionParams(
318-
textEditor.document,
319-
textEditor.selection.active,
320-
);
321-
let locations: Location[];
322-
try {
323-
locations = await this.lc.sendRequest<Location[]>(request, params);
324-
} catch (reason) {
325-
window.showWarningMessage(`find implementations failed: ${reason}`);
326-
return;
327-
}
328-
329-
return commands.executeCommand(
330-
'editor.action.showReferences',
331-
textEditor.document.uri,
332-
textEditor.selection.active,
333-
locations.map(this.lc.protocol2CodeConverter.asLocation),
334-
);
335-
},
336-
);
337-
this.disposables.push(findImplsDisposable);
338-
339301
const rustupUpdateDisposable = commands.registerCommand(
340302
'rls.update',
341303
() => {

0 commit comments

Comments
 (0)