Skip to content

Commit

Permalink
use language client 8.0.0-next.4 and vscode 1.61
Browse files Browse the repository at this point in the history
Signed-off-by: Shi Chen <[email protected]>
  • Loading branch information
CsCherrYY committed Apr 18, 2022
1 parent 0868943 commit 88a3c21
Show file tree
Hide file tree
Showing 6 changed files with 39 additions and 50 deletions.
60 changes: 25 additions & 35 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 @@ -1185,7 +1185,7 @@
"glob": "^7.1.3",
"jdk-utils": "^0.4.3",
"semver": "^7.3.5",
"vscode-languageclient": "7.1.0-next.5",
"vscode-languageclient": "8.0.0-next.4",
"winreg-utf8": "^0.1.1",
"winston": "^3.2.1",
"winston-daily-rotate-file": "^3.10.0"
Expand Down
9 changes: 4 additions & 5 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -252,8 +252,8 @@ export function activate(context: ExtensionContext): Promise<ExtensionAPI> {
},
middleware: {
workspace: {
didChangeConfiguration: () => {
standardClient.getClient().sendNotification(DidChangeConfigurationNotification.type, {
didChangeConfiguration: async () => {
await standardClient.getClient().sendNotification(DidChangeConfigurationNotification.type, {
settings: {
java: getJavaConfig(requirements.java_home),
}
Expand All @@ -263,7 +263,7 @@ export function activate(context: ExtensionContext): Promise<ExtensionAPI> {
// https://github.com/redhat-developer/vscode-java/issues/2130
// include all diagnostics for the current line in the CodeActionContext params for the performance reason
provideCodeActions: (document, range, context, token, next) => {
const client: any = standardClient.getClient();
const client: LanguageClient = standardClient.getClient();
const params: CodeActionParams = {
textDocument: client.code2ProtocolConverter.asTextDocumentIdentifier(document),
range: client.code2ProtocolConverter.asRange(range),
Expand All @@ -285,8 +285,8 @@ export function activate(context: ExtensionContext): Promise<ExtensionAPI> {
}
const codeActionContext: CodeActionContext = {
diagnostics: allDiagnostics,
triggerKind: CodeActionTriggerKind?.Automatic,
only: context.only,
triggerKind: CodeActionTriggerKind.Invoke,
};
params.context = client.code2ProtocolConverter.asCodeActionContext(codeActionContext);
}
Expand All @@ -306,7 +306,6 @@ export function activate(context: ExtensionContext): Promise<ExtensionAPI> {
}
return result;
}, (error) => {
client.logFailedRequest(CodeActionRequest.type, error);
return Promise.resolve([]);
});
}
Expand Down
2 changes: 1 addition & 1 deletion src/refactorAction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ async function applyRefactorEdit(languageClient: LanguageClient, refactorEdit: R
}

if (refactorEdit.edit) {
const edit = languageClient.protocol2CodeConverter.asWorkspaceEdit(refactorEdit.edit);
const edit = await languageClient.protocol2CodeConverter.asWorkspaceEdit(refactorEdit.edit);
if (edit) {
await workspace.applyEdit(edit);
}
Expand Down
12 changes: 6 additions & 6 deletions src/standardLanguageClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -315,15 +315,15 @@ export class StandardLanguageClient {
commands.executeCommand(Commands.SHOW_REFERENCES, Uri.parse(uri), this.languageClient.protocol2CodeConverter.asPosition(position), locations.map(this.languageClient.protocol2CodeConverter.asLocation));
}));

context.subscriptions.push(commands.registerCommand(Commands.CONFIGURATION_UPDATE, uri => projectConfigurationUpdate(this.languageClient, uri)));
context.subscriptions.push(commands.registerCommand(Commands.CONFIGURATION_UPDATE, async (uri) => projectConfigurationUpdate(this.languageClient, uri)));

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

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

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

context.subscriptions.push(commands.registerCommand(Commands.APPLY_WORKSPACE_EDIT, (obj) => {
applyWorkspaceEdit(obj, this.languageClient);
Expand Down Expand Up @@ -582,7 +582,7 @@ function setIncompleteClasspathSeverity(severity: string) {
);
}

function projectConfigurationUpdate(languageClient: LanguageClient, uri?: Uri) {
async function projectConfigurationUpdate(languageClient: LanguageClient, uri?: Uri) {
let resource = uri;
if (!(resource instanceof Uri)) {
if (window.activeTextEditor) {
Expand All @@ -593,7 +593,7 @@ function projectConfigurationUpdate(languageClient: LanguageClient, uri?: Uri) {
return window.showWarningMessage('No Java project to update!').then(() => false);
}
if (isJavaConfigFile(resource.path)) {
languageClient.sendNotification(ProjectConfigurationUpdateRequest.type, {
await languageClient.sendNotification(ProjectConfigurationUpdateRequest.type, {
uri: resource.toString()
});
}
Expand All @@ -605,7 +605,7 @@ function isJavaConfigFile(filePath: string) {
return regEx.test(fileName);
}

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

Expand All @@ -615,7 +615,7 @@ function setProjectConfigurationUpdate(languageClient: LanguageClient, uri: Uri,
(error) => logger.error(error)
);
if (status !== FeatureStatus.disabled) {
projectConfigurationUpdate(languageClient, uri);
await projectConfigurationUpdate(languageClient, uri);
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/syntaxLanguageClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ export class SyntaxLanguageClient {
const newClientOptions: LanguageClientOptions = Object.assign({}, clientOptions, {
middleware: {
workspace: {
didChangeConfiguration: () => {
this.languageClient.sendNotification(DidChangeConfigurationNotification.type, {
didChangeConfiguration: async () => {
await this.languageClient.sendNotification(DidChangeConfigurationNotification.type, {
settings: {
java: getJavaConfig(requirements.java_home),
}
Expand Down

0 comments on commit 88a3c21

Please sign in to comment.