Skip to content

Commit b2f195c

Browse files
committed
More robust check for sourcekit crash notification
1 parent ba24ddd commit b2f195c

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

src/sourcekit-lsp/LanguageClientManager.ts

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -541,15 +541,13 @@ export class LanguageClientManager {
541541
);
542542
},
543543
handleWorkDoneProgress: (() => {
544-
let restoringLSPStarted = false;
544+
let hasPrompted = false;
545545
return async (token, params, next) => {
546546
const result = await next(token, params);
547-
const title = (params as langclient.WorkDoneProgressBegin).title;
548-
if (title === "SourceKit-LSP: Restoring functionality") {
549-
restoringLSPStarted = true;
550-
} else if (params.kind === "end" && restoringLSPStarted) {
551-
restoringLSPStarted = false;
552-
await promptForDiagnostics(this.workspaceContext);
547+
if (!hasPrompted && token.toString().startsWith("sourcekitd-crashed")) {
548+
// Only prompt once in case sourcekit is in a crash loop
549+
hasPrompted = true;
550+
promptForDiagnostics(this.workspaceContext);
553551
}
554552
return result;
555553
};

0 commit comments

Comments
 (0)