-
Notifications
You must be signed in to change notification settings - Fork 152
Add shutdown command #866
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add shutdown command #866
Changes from 5 commits
52dddd5
e07815d
cfb95da
838429a
808e545
e2d3ef4
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -19,10 +19,16 @@ export async function activate(context: vscode.ExtensionContext): | |
|
|
||
| let clangdContext: ClangdContext|null = null; | ||
|
|
||
| // An empty place holder for the activate command, otherwise we'll get an | ||
| // "command is not registered" error. | ||
| context.subscriptions.push( | ||
| vscode.commands.registerCommand('clangd.activate', async () => {})); | ||
| vscode.commands.registerCommand('clangd.activate', async () => { | ||
| if (clangdContext && clangdContext.clientIsStarting()) { | ||
| return; | ||
| } | ||
| if (clangdContext && clangdContext.clientIsRunning()) { | ||
|
||
| return; | ||
| } | ||
| vscode.commands.executeCommand('clangd.restart'); | ||
| })); | ||
| context.subscriptions.push( | ||
| vscode.commands.registerCommand('clangd.restart', async () => { | ||
| if (!get<boolean>('enable')) { | ||
|
|
@@ -58,6 +64,14 @@ export async function activate(context: vscode.ExtensionContext): | |
| apiInstance.client = clangdContext?.client; | ||
| } | ||
| })); | ||
| context.subscriptions.push( | ||
| vscode.commands.registerCommand('clangd.shutdown', async () => { | ||
| if (clangdContext && clangdContext.clientIsStarting()) { | ||
| return; | ||
| } | ||
| if (clangdContext) | ||
| clangdContext.dispose(); | ||
| })); | ||
|
|
||
| let shouldCheck = false; | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: combine these conditions (
clangdContext.clientIsStarting() || clangdContext.clientisRunning())?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done