Skip to content

Commit

Permalink
Move to vscode-languageclient 8.0.1
Browse files Browse the repository at this point in the history
Fixes redhat-developer#711

Signed-off-by: azerr <[email protected]>
  • Loading branch information
angelozerr committed May 19, 2022
1 parent 7d43ea3 commit 1c1a7e1
Show file tree
Hide file tree
Showing 5 changed files with 49 additions and 40 deletions.
64 changes: 32 additions & 32 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@
"fs-extra": "^8.1.0",
"glob": "^7.1.4",
"path-exists": "^4.0.0",
"vscode-languageclient": "^7.0.0",
"vscode-languageclient": "^8.0.1",
"yauzl": "^2.10.0"
},
"contributes": {
Expand Down
16 changes: 12 additions & 4 deletions src/client/clientErrorHandler.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as fs from "fs-extra";
import { commands, ExtensionContext, window, workspace } from "vscode";
import { CloseAction, ErrorAction, ErrorHandler, Message } from "vscode-languageclient";
import { CloseAction, CloseHandlerResult, ErrorAction, ErrorHandler, ErrorHandlerResult, Message } from "vscode-languageclient";
import { ClientCommandConstants } from "../commands/commandConstants";
import { HEAP_DUMP_LOCATION } from "../server/java/jvmArguments";
import { Telemetry } from "../telemetry";
Expand All @@ -27,11 +27,19 @@ export class ClientErrorHandler implements ErrorHandler {
this.heapDumpFolder = getHeapDumpFolderFromSettings() || context.globalStorageUri.fsPath;
}

error(_error: Error, _message: Message, _count: number): ErrorAction {
return ErrorAction.Continue;
error(error: Error, message: Message, count: number): ErrorHandlerResult {
return {
action: ErrorAction.Continue
};
}

closed(): CloseAction {
closed(): CloseHandlerResult {
return {
action: this.doClosed()
}
}

doClosed(): CloseAction {
this.restarts.push(Date.now());
const heapProfileGlob = new glob.GlobSync(`${this.heapDumpFolder}/java_*.hprof`);
if (heapProfileGlob.found.length) {
Expand Down
6 changes: 3 additions & 3 deletions src/client/xmlClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,7 @@ export async function startLanguageClient(context: ExtensionContext, executable:
return Telemetry.sendTelemetry(e.name, e.properties);
});

context.subscriptions.push(languageClient.start());
await languageClient.onReady();
await languageClient.start();

// ---

Expand Down Expand Up @@ -155,8 +154,9 @@ function getLanguageClientOptions(
middleware: {
workspace: {
didChangeConfiguration: () => {
languageClient.sendNotification(DidChangeConfigurationNotification.type, { settings: getXMLSettings(requirementsData.java_home, logfile, externalXmlSettings) });
const result = languageClient.sendNotification(DidChangeConfigurationNotification.type, { settings: getXMLSettings(requirementsData.java_home, logfile, externalXmlSettings) });
onConfigurationChange();
return result;
}
}
}
Expand Down
1 change: 1 addition & 0 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,5 +70,6 @@ export async function activate(context: ExtensionContext): Promise<XMLExtensionA
export async function deactivate(): Promise<void> {
if (languageClient) {
await languageClient.stop();
languageClient = undefined;
}
}

0 comments on commit 1c1a7e1

Please sign in to comment.