Skip to content

Commit 88a3c21

Browse files
committed
use language client 8.0.0-next.4 and vscode 1.61
Signed-off-by: Shi Chen <[email protected]>
1 parent 0868943 commit 88a3c21

File tree

6 files changed

+39
-50
lines changed

6 files changed

+39
-50
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
@@ -1185,7 +1185,7 @@
11851185
"glob": "^7.1.3",
11861186
"jdk-utils": "^0.4.3",
11871187
"semver": "^7.3.5",
1188-
"vscode-languageclient": "7.1.0-next.5",
1188+
"vscode-languageclient": "8.0.0-next.4",
11891189
"winreg-utf8": "^0.1.1",
11901190
"winston": "^3.2.1",
11911191
"winston-daily-rotate-file": "^3.10.0"

src/extension.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -252,8 +252,8 @@ export function activate(context: ExtensionContext): Promise<ExtensionAPI> {
252252
},
253253
middleware: {
254254
workspace: {
255-
didChangeConfiguration: () => {
256-
standardClient.getClient().sendNotification(DidChangeConfigurationNotification.type, {
255+
didChangeConfiguration: async () => {
256+
await standardClient.getClient().sendNotification(DidChangeConfigurationNotification.type, {
257257
settings: {
258258
java: getJavaConfig(requirements.java_home),
259259
}
@@ -263,7 +263,7 @@ export function activate(context: ExtensionContext): Promise<ExtensionAPI> {
263263
// https://github.com/redhat-developer/vscode-java/issues/2130
264264
// include all diagnostics for the current line in the CodeActionContext params for the performance reason
265265
provideCodeActions: (document, range, context, token, next) => {
266-
const client: any = standardClient.getClient();
266+
const client: LanguageClient = standardClient.getClient();
267267
const params: CodeActionParams = {
268268
textDocument: client.code2ProtocolConverter.asTextDocumentIdentifier(document),
269269
range: client.code2ProtocolConverter.asRange(range),
@@ -285,8 +285,8 @@ export function activate(context: ExtensionContext): Promise<ExtensionAPI> {
285285
}
286286
const codeActionContext: CodeActionContext = {
287287
diagnostics: allDiagnostics,
288+
triggerKind: CodeActionTriggerKind?.Automatic,
288289
only: context.only,
289-
triggerKind: CodeActionTriggerKind.Invoke,
290290
};
291291
params.context = client.code2ProtocolConverter.asCodeActionContext(codeActionContext);
292292
}
@@ -306,7 +306,6 @@ export function activate(context: ExtensionContext): Promise<ExtensionAPI> {
306306
}
307307
return result;
308308
}, (error) => {
309-
client.logFailedRequest(CodeActionRequest.type, error);
310309
return Promise.resolve([]);
311310
});
312311
}

src/refactorAction.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ async function applyRefactorEdit(languageClient: LanguageClient, refactorEdit: R
214214
}
215215

216216
if (refactorEdit.edit) {
217-
const edit = languageClient.protocol2CodeConverter.asWorkspaceEdit(refactorEdit.edit);
217+
const edit = await languageClient.protocol2CodeConverter.asWorkspaceEdit(refactorEdit.edit);
218218
if (edit) {
219219
await workspace.applyEdit(edit);
220220
}

src/standardLanguageClient.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -315,15 +315,15 @@ 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) => projectConfigurationUpdate(this.languageClient, uri)));
319319

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

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

326-
context.subscriptions.push(commands.registerCommand(Commands.PROJECT_CONFIGURATION_STATUS, (uri, status) => setProjectConfigurationUpdate(this.languageClient, uri, status)));
326+
context.subscriptions.push(commands.registerCommand(Commands.PROJECT_CONFIGURATION_STATUS, async (uri, status) => setProjectConfigurationUpdate(this.languageClient, uri, status)));
327327

328328
context.subscriptions.push(commands.registerCommand(Commands.APPLY_WORKSPACE_EDIT, (obj) => {
329329
applyWorkspaceEdit(obj, this.languageClient);
@@ -582,7 +582,7 @@ function setIncompleteClasspathSeverity(severity: string) {
582582
);
583583
}
584584

585-
function projectConfigurationUpdate(languageClient: LanguageClient, uri?: Uri) {
585+
async function projectConfigurationUpdate(languageClient: LanguageClient, uri?: Uri) {
586586
let resource = uri;
587587
if (!(resource instanceof Uri)) {
588588
if (window.activeTextEditor) {
@@ -593,7 +593,7 @@ function projectConfigurationUpdate(languageClient: LanguageClient, uri?: Uri) {
593593
return window.showWarningMessage('No Java project to update!').then(() => false);
594594
}
595595
if (isJavaConfigFile(resource.path)) {
596-
languageClient.sendNotification(ProjectConfigurationUpdateRequest.type, {
596+
await languageClient.sendNotification(ProjectConfigurationUpdateRequest.type, {
597597
uri: resource.toString()
598598
});
599599
}
@@ -605,7 +605,7 @@ function isJavaConfigFile(filePath: string) {
605605
return regEx.test(fileName);
606606
}
607607

608-
function setProjectConfigurationUpdate(languageClient: LanguageClient, uri: Uri, status: FeatureStatus) {
608+
async function setProjectConfigurationUpdate(languageClient: LanguageClient, uri: Uri, status: FeatureStatus) {
609609
const config = getJavaConfiguration();
610610
const section = 'configuration.updateBuildConfiguration';
611611

@@ -615,7 +615,7 @@ function setProjectConfigurationUpdate(languageClient: LanguageClient, uri: Uri,
615615
(error) => logger.error(error)
616616
);
617617
if (status !== FeatureStatus.disabled) {
618-
projectConfigurationUpdate(languageClient, uri);
618+
await projectConfigurationUpdate(languageClient, uri);
619619
}
620620
}
621621

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)