Skip to content

Commit 874659d

Browse files
committed
Show warning message when reindexing project
Show a warning informing the user that they shouldn't have to reindex the project, and doing so indicates a bug in SourceKit-LSP. Show a button that links out to the SourceKit-LSP issue creation page, prepopulating the issue title as "Symbol Indexing Issue". Requested by @ahoppen in #964 (comment)
1 parent efb2f9f commit 874659d

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

src/commands.ts

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -661,7 +661,20 @@ function restartLSPServer(workspaceContext: WorkspaceContext): Promise<void> {
661661
function reindexProject(workspaceContext: WorkspaceContext): Promise<unknown> {
662662
return workspaceContext.languageClientManager.useLanguageClient(async (client, token) => {
663663
try {
664-
return await client.sendRequest(reindexProjectRequest, {}, token);
664+
await client.sendRequest(reindexProjectRequest, {}, token);
665+
const result = await vscode.window.showWarningMessage(
666+
"Re-indexing a project should never be necessary and indicates a bug in SourceKit-LSP. Please file an issue describing which symbol was out-of-date and how you got into the state.",
667+
"Report Issue",
668+
"Close"
669+
);
670+
if (result === "Report Issue") {
671+
vscode.commands.executeCommand(
672+
"vscode.open",
673+
vscode.Uri.parse(
674+
"https://github.com/swiftlang/sourcekit-lsp/issues/new?title=Symbol%20Indexing%20Issue"
675+
)
676+
);
677+
}
665678
} catch (err) {
666679
const error = err as { code: number; message: string };
667680
// methodNotFound, version of sourcekit-lsp is likely too old.

0 commit comments

Comments
 (0)