Skip to content

Commit 981d861

Browse files
authored
Merge pull request #460 from rescript-lang/upgrade-lsp
Upgrade LSP related packages
2 parents 409d758 + ffca9bb commit 981d861

8 files changed

+152
-163
lines changed

client/package-lock.json

+35-35
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

client/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,6 @@
77
"author": "chenglou",
88
"license": "MIT",
99
"dependencies": {
10-
"vscode-languageclient": "^7.0.0"
10+
"vscode-languageclient": "^8.0.1"
1111
}
1212
}

client/src/extension.ts

+20-15
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import {
1212
LanguageClient,
1313
LanguageClientOptions,
1414
ServerOptions,
15+
State,
1516
TransportKind,
1617
} from "vscode-languageclient/node";
1718

@@ -113,19 +114,23 @@ export function activate(context: ExtensionContext) {
113114
// compilation has finished, and the most reliable source for that is the LS
114115
// server, that already keeps track of when the compiler finishes in order to
115116
// other provide fresh diagnostics.
116-
client.onReady().then(() => {
117-
context.subscriptions.push(
118-
client.onNotification("rescript/compilationFinished", () => {
119-
if (inCodeAnalysisState.active === true) {
120-
customCommands.codeAnalysisWithReanalyze(
121-
inCodeAnalysisState.activatedFromDirectory,
122-
diagnosticsCollection,
123-
diagnosticsResultCodeActions
124-
);
125-
}
126-
})
127-
);
128-
});
117+
context.subscriptions.push(
118+
client.onDidChangeState(({ newState }) => {
119+
if (newState === State.Running) {
120+
context.subscriptions.push(
121+
client.onNotification("rescript/compilationFinished", () => {
122+
if (inCodeAnalysisState.active === true) {
123+
customCommands.codeAnalysisWithReanalyze(
124+
inCodeAnalysisState.activatedFromDirectory,
125+
diagnosticsCollection,
126+
diagnosticsResultCodeActions
127+
);
128+
}
129+
})
130+
);
131+
}
132+
})
133+
);
129134

130135
return client;
131136
}
@@ -223,12 +228,12 @@ export function activate(context: ExtensionContext) {
223228
commands.registerCommand("rescript-vscode.restart_language_server", () => {
224229
client.stop().then(() => {
225230
client = createLanguageClient();
226-
context.subscriptions.push(client.start());
231+
client.start();
227232
});
228233
});
229234

230235
// Start the client. This will also launch the server
231-
context.subscriptions.push(client.start());
236+
client.start();
232237

233238
// Autostart code analysis if wanted
234239
if (

package-lock.json

+15-15
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
"language-server"
2222
],
2323
"engines": {
24-
"vscode": "^1.55.0"
24+
"vscode": "^1.68.0"
2525
},
2626
"activationEvents": [
2727
"onLanguage:rescript"
@@ -164,7 +164,7 @@
164164
},
165165
"devDependencies": {
166166
"@types/node": "^14.14.41",
167-
"@types/vscode": "1.55.0",
168-
"typescript": "^4.2.4"
167+
"@types/vscode": "1.68.0",
168+
"typescript": "^4.7.3"
169169
}
170170
}

server/package-lock.json

+34-49
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)