Skip to content

Commit

Permalink
use language client 8.0.0-next.4
Browse files Browse the repository at this point in the history
Signed-off-by: Shi Chen <[email protected]>
  • Loading branch information
CsCherrYY committed Jan 30, 2023
1 parent 2cdb0ce commit 9b1e44f
Show file tree
Hide file tree
Showing 6 changed files with 50 additions and 56 deletions.
78 changes: 34 additions & 44 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 @@ -1414,7 +1414,7 @@
"htmlparser2": "6.0.1",
"jdk-utils": "^0.4.4",
"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
6 changes: 3 additions & 3 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -174,8 +174,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 Down Expand Up @@ -208,7 +208,7 @@ export function activate(context: ExtensionContext): Promise<ExtensionAPI> {
const codeActionContext: CodeActionContext = {
diagnostics: allDiagnostics,
only: context.only,
triggerKind: CodeActionTriggerKind.Invoke,
triggerKind: context.triggerKind,
};
params.context = client.code2ProtocolConverter.asCodeActionContext(codeActionContext);
}
Expand Down
12 changes: 8 additions & 4 deletions src/standardLanguageClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -325,15 +325,19 @@ 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) => {
await 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) => {
await setProjectConfigurationUpdate(this.languageClient, uri, status);
}));

context.subscriptions.push(commands.registerCommand(Commands.NULL_ANALYSIS_SET_MODE, (status) => setNullAnalysisStatus(status)));

Expand Down Expand Up @@ -675,7 +679,7 @@ function setIncompleteClasspathSeverity(severity: string) {
);
}

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 @@ -685,7 +689,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/standardLanguageClientUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,11 @@ export async function projectConfigurationUpdate(languageClient: LanguageClient,
}

if (resources.length === 1) {
languageClient.sendNotification(ProjectConfigurationUpdateRequest.type, {
await languageClient.sendNotification(ProjectConfigurationUpdateRequest.type, {
uri: resources[0].toString(),
});
} else if (resources.length > 1) {
languageClient.sendNotification(ProjectConfigurationUpdateRequest.typeV2, {
await languageClient.sendNotification(ProjectConfigurationUpdateRequest.typeV2, {
identifiers: resources.map(r => {
return { uri: r.toString() };
}),
Expand Down
4 changes: 2 additions & 2 deletions src/syntaxLanguageClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,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 9b1e44f

Please sign in to comment.