Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 3b7ad6c

Browse files
committed
Bump deps, implement deactivate
1 parent 3d16cf1 commit 3b7ad6c

File tree

3 files changed

+194
-363
lines changed

3 files changed

+194
-363
lines changed

package.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -93,12 +93,12 @@
9393
"watch": "tsc --watch -p ./"
9494
},
9595
"dependencies": {
96-
"vscode-languageclient": "^7.0.0"
96+
"vscode-languageclient": "^8.0.1"
9797
},
9898
"devDependencies": {
99-
"@types/node": "^17.0.23",
100-
"@types/vscode": "^1.66.0",
101-
"typescript": "^4.6.3",
102-
"vsce": "^2.7.0"
99+
"@types/node": "^18.0.0",
100+
"@types/vscode": "^1.68.0",
101+
"typescript": "^4.7.4",
102+
"vsce": "^2.9.2"
103103
}
104104
}

src/extension.ts

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,18 @@ import Visualize from "./Visualize";
1010

1111
const promiseExec = promisify(exec);
1212

13-
// This is the expected top-level export that is called by VSCode.
14-
export function activate(context: ExtensionContext) {
13+
// This object will get initialized once the language client is ready. It will
14+
// get set back to null when the extension is deactivated.
15+
let languageClient: LanguageClient | null = null;
16+
17+
// This is the expected top-level export that is called by VSCode when the
18+
// extension is activated.
19+
export async function activate(context: ExtensionContext) {
1520
// This output channel is going to contain all of our informational messages.
1621
// It's not really meant for the end-user, it's more for debugging.
1722
const outputChannel = window.createOutputChannel("Syntax Tree");
1823

19-
// These objects will get initialized once the language client is ready.
20-
let languageClient: LanguageClient | null = null;
24+
// This object will get initialized once the language client is ready.
2125
let visualizer: Visualize | null = null;
2226

2327
// This is the list of objects that implement the Disposable interface. They
@@ -46,7 +50,7 @@ export function activate(context: ExtensionContext) {
4650

4751
// We're returning a Promise from this function that will start the Ruby
4852
// subprocess.
49-
return startLanguageServer();
53+
await startLanguageServer();
5054

5155
// This function is called when the extension is activated or when the
5256
// language server is restarted.
@@ -110,8 +114,7 @@ export function activate(context: ExtensionContext) {
110114
});
111115

112116
// Here we're going to wait for the language server to start.
113-
context.subscriptions.push(languageClient.start());
114-
await languageClient.onReady();
117+
await languageClient.start();
115118

116119
// Finally, now that the language server has been properly started, we can
117120
// add the various features to the extension. Each of them in turn
@@ -142,3 +145,10 @@ export function activate(context: ExtensionContext) {
142145
await startLanguageServer();
143146
}
144147
}
148+
149+
// This is the expected top-level export that is called by VSCode when the
150+
// extension is deactivated.
151+
export async function deactivate() {
152+
await languageClient?.stop();
153+
languageClient = null;
154+
}

0 commit comments

Comments
 (0)