Skip to content

Commit 7d6fb9a

Browse files
committed
use language client 8.0.0-next.4
Signed-off-by: Shi Chen <[email protected]>
1 parent 81eafc3 commit 7d6fb9a

File tree

5 files changed

+42
-49
lines changed

5 files changed

+42
-49
lines changed

package-lock.json

Lines changed: 25 additions & 35 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1184,7 +1184,7 @@
11841184
"glob": "^7.1.3",
11851185
"jdk-utils": "^0.4.3",
11861186
"semver": "^7.3.5",
1187-
"vscode-languageclient": "7.1.0-next.5",
1187+
"vscode-languageclient": "8.0.0-next.4",
11881188
"winreg-utf8": "^0.1.1",
11891189
"winston": "^3.2.1",
11901190
"winston-daily-rotate-file": "^3.10.0"

src/extension.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -250,8 +250,8 @@ export function activate(context: ExtensionContext): Promise<ExtensionAPI> {
250250
},
251251
middleware: {
252252
workspace: {
253-
didChangeConfiguration: () => {
254-
standardClient.getClient().sendNotification(DidChangeConfigurationNotification.type, {
253+
didChangeConfiguration: async () => {
254+
await standardClient.getClient().sendNotification(DidChangeConfigurationNotification.type, {
255255
settings: {
256256
java: getJavaConfig(requirements.java_home),
257257
}
@@ -284,7 +284,7 @@ export function activate(context: ExtensionContext): Promise<ExtensionAPI> {
284284
const codeActionContext: CodeActionContext = {
285285
diagnostics: allDiagnostics,
286286
only: context.only,
287-
triggerKind: CodeActionTriggerKind.Invoke,
287+
triggerKind: context.triggerKind,
288288
};
289289
params.context = client.code2ProtocolConverter.asCodeActionContext(codeActionContext);
290290
}
@@ -303,8 +303,7 @@ export function activate(context: ExtensionContext): Promise<ExtensionAPI> {
303303
}
304304
}
305305
return result;
306-
}, (error) => {
307-
client.logFailedRequest(CodeActionRequest.type, error);
306+
}, () => {
308307
return Promise.resolve([]);
309308
});
310309
}

src/standardLanguageClient.ts

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -315,15 +315,19 @@ export class StandardLanguageClient {
315315
commands.executeCommand(Commands.SHOW_REFERENCES, Uri.parse(uri), this.languageClient.protocol2CodeConverter.asPosition(position), locations.map(this.languageClient.protocol2CodeConverter.asLocation));
316316
}));
317317

318-
context.subscriptions.push(commands.registerCommand(Commands.CONFIGURATION_UPDATE, uri => projectConfigurationUpdate(this.languageClient, uri)));
318+
context.subscriptions.push(commands.registerCommand(Commands.CONFIGURATION_UPDATE, async (uri) => {
319+
await projectConfigurationUpdate(this.languageClient, uri);
320+
}));
319321

320322
context.subscriptions.push(commands.registerCommand(Commands.IGNORE_INCOMPLETE_CLASSPATH, () => setIncompleteClasspathSeverity('ignore')));
321323

322324
context.subscriptions.push(commands.registerCommand(Commands.IGNORE_INCOMPLETE_CLASSPATH_HELP, () => {
323325
commands.executeCommand(Commands.OPEN_BROWSER, Uri.parse('https://github.com/redhat-developer/vscode-java/wiki/%22Classpath-is-incomplete%22-warning'));
324326
}));
325327

326-
context.subscriptions.push(commands.registerCommand(Commands.PROJECT_CONFIGURATION_STATUS, (uri, status) => setProjectConfigurationUpdate(this.languageClient, uri, status)));
328+
context.subscriptions.push(commands.registerCommand(Commands.PROJECT_CONFIGURATION_STATUS, async (uri, status) => {
329+
await setProjectConfigurationUpdate(this.languageClient, uri, status);
330+
}));
327331

328332
context.subscriptions.push(commands.registerCommand(Commands.APPLY_WORKSPACE_EDIT, (obj) => {
329333
applyWorkspaceEdit(obj, this.languageClient);
@@ -582,7 +586,7 @@ function setIncompleteClasspathSeverity(severity: string) {
582586
);
583587
}
584588

585-
function projectConfigurationUpdate(languageClient: LanguageClient, uri?: Uri) {
589+
async function projectConfigurationUpdate(languageClient: LanguageClient, uri?: Uri) {
586590
let resource = uri;
587591
if (!(resource instanceof Uri)) {
588592
if (window.activeTextEditor) {
@@ -593,7 +597,7 @@ function projectConfigurationUpdate(languageClient: LanguageClient, uri?: Uri) {
593597
return window.showWarningMessage('No Java project to update!').then(() => false);
594598
}
595599
if (isJavaConfigFile(resource.path)) {
596-
languageClient.sendNotification(ProjectConfigurationUpdateRequest.type, {
600+
await languageClient.sendNotification(ProjectConfigurationUpdateRequest.type, {
597601
uri: resource.toString()
598602
});
599603
}
@@ -605,7 +609,7 @@ function isJavaConfigFile(filePath: string) {
605609
return regEx.test(fileName);
606610
}
607611

608-
function setProjectConfigurationUpdate(languageClient: LanguageClient, uri: Uri, status: FeatureStatus) {
612+
async function setProjectConfigurationUpdate(languageClient: LanguageClient, uri: Uri, status: FeatureStatus) {
609613
const config = getJavaConfiguration();
610614
const section = 'configuration.updateBuildConfiguration';
611615

@@ -615,7 +619,7 @@ function setProjectConfigurationUpdate(languageClient: LanguageClient, uri: Uri,
615619
(error) => logger.error(error)
616620
);
617621
if (status !== FeatureStatus.disabled) {
618-
projectConfigurationUpdate(languageClient, uri);
622+
await projectConfigurationUpdate(languageClient, uri);
619623
}
620624
}
621625

src/syntaxLanguageClient.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ export class SyntaxLanguageClient {
2121
const newClientOptions: LanguageClientOptions = Object.assign({}, clientOptions, {
2222
middleware: {
2323
workspace: {
24-
didChangeConfiguration: () => {
25-
this.languageClient.sendNotification(DidChangeConfigurationNotification.type, {
24+
didChangeConfiguration: async () => {
25+
await this.languageClient.sendNotification(DidChangeConfigurationNotification.type, {
2626
settings: {
2727
java: getJavaConfig(requirements.java_home),
2828
}

0 commit comments

Comments
 (0)