Skip to content

Commit 900eccb

Browse files
Fix check for clangd.restart being a no-op (#601)
The intention was to only catch the case where the language server is already starting because running the restart command triggered activation of the plugin, but it was also catching the case where the language server wasn't running at all. Fixes #599
1 parent a3925bb commit 900eccb

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

src/clangd-context.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -191,8 +191,8 @@ export class ClangdContext implements vscode.Disposable {
191191
(e) => isClangdDocument(e.document));
192192
}
193193

194-
clientIsReady() {
195-
return this.client && this.client.state == vscodelc.State.Running;
194+
clientIsStarting() {
195+
return this.client && this.client.state == vscodelc.State.Starting;
196196
}
197197

198198
dispose() {

src/extension.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ export async function activate(context: vscode.ExtensionContext) {
2525
// stop/start cycle in this situation is pointless, and doesn't work
2626
// anyways because the client can't be stop()-ped when it's still in the
2727
// Starting state).
28-
if (!clangdContext.clientIsReady()) {
28+
if (clangdContext.clientIsStarting()) {
2929
return;
3030
}
3131
await clangdContext.dispose();

test/inactive-regions.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ class MockClangdContext implements ClangdContext {
1616

1717
async activate() { throw new Error('Method not implemented.'); }
1818

19-
clientIsReady() { return true; }
19+
clientIsStarting() { return false; }
2020

2121
dispose() { throw new Error('Method not implemented.'); }
2222
}

0 commit comments

Comments
 (0)