-
Notifications
You must be signed in to change notification settings - Fork 451
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update language-client to 8.1.0 #2377
Changes from 5 commits
bc7ecfa
e6b0755
9c2074c
6c034d8
72619f2
74abcaf
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,7 +6,7 @@ import * as fse from 'fs-extra'; | |
import * as os from 'os'; | ||
import * as path from 'path'; | ||
import { CodeActionContext, CodeActionTriggerKind, commands, ConfigurationTarget, Diagnostic, env, EventEmitter, ExtensionContext, extensions, IndentAction, InputBoxOptions, languages, RelativePattern, TextDocument, UIKind, Uri, ViewColumn, window, workspace, WorkspaceConfiguration } from 'vscode'; | ||
import { CancellationToken, CodeActionParams, CodeActionRequest, Command, DidChangeConfigurationNotification, ExecuteCommandParams, ExecuteCommandRequest, LanguageClientOptions, RevealOutputChannelOn } from 'vscode-languageclient'; | ||
import { CancellationToken, CodeActionParams, CodeActionRequest, Command, DidChangeConfigurationNotification, ExecuteCommandParams, ExecuteCommandRequest, LanguageClientOptions, RevealOutputChannelOn, State } from 'vscode-languageclient'; | ||
import { LanguageClient } from 'vscode-languageclient/node'; | ||
import { apiManager } from './apiManager'; | ||
import { ClientErrorHandler } from './clientErrorHandler'; | ||
|
@@ -167,16 +167,17 @@ export function activate(context: ExtensionContext): Promise<ExtensionAPI> { | |
resolveAdditionalTextEditsSupport: true, | ||
advancedIntroduceParameterRefactoringSupport: true, | ||
actionableRuntimeNotificationSupport: true, | ||
shouldLanguageServerExitOnShutdown: true, | ||
// https://github.com/redhat-developer/vscode-java/pull/2377#issuecomment-1427268344 | ||
shouldLanguageServerExitOnShutdown: false, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, this was fixed in the language client release that supported 3.17. Original issue is at #1928 (comment) . There's no need to set it to false as that's the default value anyways on the server side. In fact, there's a good argument for getting rid of it entirely since it was really to handle some non-protocol behaviour. |
||
onCompletionItemSelectedCommand: "editor.action.triggerParameterHints", | ||
extractInterfaceSupport: true, | ||
}, | ||
triggerFiles, | ||
}, | ||
middleware: { | ||
workspace: { | ||
didChangeConfiguration: () => { | ||
standardClient.getClient().sendNotification(DidChangeConfigurationNotification.type, { | ||
didChangeConfiguration: async () => { | ||
await standardClient.getClient().sendNotification(DidChangeConfigurationNotification.type, { | ||
settings: { | ||
java: getJavaConfig(requirements.java_home), | ||
} | ||
|
@@ -185,12 +186,12 @@ 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) => { | ||
provideCodeActions: async (document, range, context, token, next) => { | ||
const client: LanguageClient = standardClient.getClient(); | ||
const params: CodeActionParams = { | ||
textDocument: client.code2ProtocolConverter.asTextDocumentIdentifier(document), | ||
range: client.code2ProtocolConverter.asRange(range), | ||
context: client.code2ProtocolConverter.asCodeActionContext(context) | ||
context: await client.code2ProtocolConverter.asCodeActionContext(context) | ||
}; | ||
const showAt = getJavaConfiguration().get<string>("quickfix.showAt"); | ||
if (showAt === 'line' && range.start.line === range.end.line && range.start.character === range.end.character) { | ||
|
@@ -209,12 +210,12 @@ 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); | ||
params.context = await client.code2ProtocolConverter.asCodeActionContext(codeActionContext); | ||
} | ||
} | ||
return client.sendRequest(CodeActionRequest.type, params, token).then((values) => { | ||
return client.sendRequest(CodeActionRequest.type, params, token).then(async (values) => { | ||
if (values === null) { | ||
return undefined; | ||
} | ||
|
@@ -224,7 +225,7 @@ export function activate(context: ExtensionContext): Promise<ExtensionAPI> { | |
result.push(client.protocol2CodeConverter.asCommand(item)); | ||
} | ||
else { | ||
result.push(client.protocol2CodeConverter.asCodeAction(item)); | ||
result.push(await client.protocol2CodeConverter.asCodeAction(item)); | ||
} | ||
} | ||
return result; | ||
|
@@ -249,13 +250,16 @@ export function activate(context: ExtensionContext): Promise<ExtensionAPI> { | |
// no need to pass `resolve` into any code past this point, | ||
// since `resolve` is a no-op from now on | ||
|
||
const serverOptions = prepareExecutable(requirements, syntaxServerWorkspacePath, getJavaConfig(requirements.java_home), context, true); | ||
if (requireSyntaxServer) { | ||
if (process.env['SYNTAXLS_CLIENT_PORT']) { | ||
syntaxClient.initialize(requirements, clientOptions); | ||
} else { | ||
syntaxClient.initialize(requirements, clientOptions, prepareExecutable(requirements, syntaxServerWorkspacePath, getJavaConfig(requirements.java_home), context, true)); | ||
syntaxClient.initialize(requirements, clientOptions, serverOptions); | ||
} | ||
syntaxClient.start(); | ||
syntaxClient.start().then(() => { | ||
syntaxClient.registerSyntaxClientActions(serverOptions); | ||
}); | ||
serverStatusBarProvider.showLightWeightStatus(); | ||
} | ||
|
||
|
@@ -430,7 +434,9 @@ async function startStandardServer(context: ExtensionContext, requirements: requ | |
apiManager.fireDidServerModeChange(ServerMode.hybrid); | ||
} | ||
await standardClient.initialize(context, requirements, clientOptions, workspacePath, jdtEventEmitter); | ||
standardClient.start(); | ||
standardClient.start().then(async () => { | ||
standardClient.registerLanguageClientActions(context, await fse.pathExists(path.join(workspacePath, ".metadata", ".plugins")), jdtEventEmitter); | ||
}); | ||
serverStatusBarProvider.showStandardStatus(); | ||
} | ||
|
||
|
@@ -532,7 +538,9 @@ export async function getActiveLanguageClient(): Promise<LanguageClient | undefi | |
return undefined; | ||
} | ||
|
||
await languageClient.onReady(); | ||
if (languageClient.needsStart()) { | ||
await languageClient.start(); | ||
} | ||
|
||
return languageClient; | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since VS Code has switched to node 16 since 1.66 (https://code.visualstudio.com/updates/v1_66#_nodemoduleversion-and-nodejs-api-update), let's update this deps as well. The update will resolve the following error: