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

Commit d82fe60

Browse files
committed
Use 3.6 Goto Impl only when the RLS version supports it
1 parent f06a57d commit d82fe60

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/extension.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,14 +204,19 @@ class ClientWorkspace {
204204
return;
205205
}
206206
await this.lc.onReady();
207+
// Prior to https://github.com/rust-lang-nursery/rls/pull/936 we used a custom
208+
// LSP message - if the implementation provider is specified this means we can use the 3.6 one.
209+
const useLSPRequest = this.lc.initializeResult &&
210+
this.lc.initializeResult.capabilities.implementationProvider === true;
211+
const request = useLSPRequest ? 'textDocument/implementation' : 'rustDocument/implementations';
207212

208213
const params =
209214
this.lc
210215
.code2ProtocolConverter
211216
.asTextDocumentPositionParams(textEditor.document, textEditor.selection.active);
212217
let locations: Location[];
213218
try {
214-
locations = await this.lc.sendRequest<Location[]>('textDocument/implementation', params);
219+
locations = await this.lc.sendRequest<Location[]>(request, params);
215220
} catch (reason) {
216221
window.showWarningMessage('find implementations failed: ' + reason);
217222
return;

0 commit comments

Comments
 (0)