Skip to content

Commit 50ffdcd

Browse files
committed
Updates with respect to new commit in sourcekit-lsp
1 parent 6695ff4 commit 50ffdcd

File tree

2 files changed

+15
-19
lines changed

2 files changed

+15
-19
lines changed

src/sourcekit-lsp/LanguageClientManager.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -561,7 +561,7 @@ export class LanguageClientManager {
561561
},
562562
errorHandler: new SourceKitLSPErrorHandler(5),
563563
initializationOptions: {
564-
peekDocuments: true, // client capability to handle `PeekDocumentsRequest`
564+
peekDocuments: true, // workaround for client capability to handle `PeekDocumentsRequest`
565565
},
566566
};
567567

@@ -637,10 +637,13 @@ export class LanguageClientManager {
637637

638638
await vscode.commands.executeCommand(
639639
"editor.action.peekLocations",
640-
params.uri ?? vscode.window.activeTextEditor?.document.uri,
641-
params.position ?? vscode.window.activeTextEditor?.selection.active,
640+
vscode.Uri.from({
641+
scheme: "file",
642+
path: new URL(params.uri).pathname,
643+
}),
644+
new vscode.Position(params.position.line, params.position.character),
642645
locations,
643-
params.multiple
646+
"peek"
644647
);
645648

646649
return { success: true };

src/sourcekit-lsp/lspExtensions.ts

Lines changed: 8 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -14,33 +14,26 @@
1414

1515
import * as ls from "vscode-languageserver-protocol";
1616
import * as langclient from "vscode-languageclient/node";
17-
import { Position, Uri } from "vscode";
17+
import * as vscode from "vscode";
1818

1919
// Definitions for non-standard requests used by sourcekit-lsp
2020

2121
// Peek Documents
2222
export interface PeekDocumentsParams {
2323
/**
24-
* The `Uri` of the text document in which to show the "peeked" editor
25-
* (default: current document in the active editor)
24+
* The `DocumentUri` of the text document in which to show the "peeked" editor
2625
*/
27-
uri?: Uri;
26+
uri: langclient.DocumentUri;
2827

2928
/**
30-
* The position in the given text document in which to show the
31-
* "peeked editor" (default: current cursor position in the active editor)
29+
* The `Position` in the given text document in which to show the "peeked editor"
3230
*/
33-
position?: Position;
31+
position: vscode.Position;
3432

3533
/**
36-
* An array `Uri` of the documents to appear inside the "peeked" editor
34+
* An array `DocumentUri` of the documents to appear inside the "peeked" editor
3735
*/
38-
locations: Uri[];
39-
40-
/**
41-
* Presentation strategy when having multiple locations (default: "peek")
42-
*/
43-
multiple: string;
36+
locations: langclient.DocumentUri[];
4437
}
4538

4639
/**
@@ -61,7 +54,7 @@ export const PeekDocumentsRequest = new langclient.RequestType<
6154
PeekDocumentsParams,
6255
PeekDocumentsResult,
6356
unknown
64-
>("sourcekit-lsp/peekDocuments");
57+
>("workspace/peekDocuments");
6558

6659
// Inlay Hints (pre Swift 5.6)
6760
export interface LegacyInlayHintsParams {

0 commit comments

Comments
 (0)