Avoid gopls crash due to -trace flag #2459
This commit is contained in:
Родитель
65ef2ea383
Коммит
d0eed08835
|
@ -91,7 +91,8 @@ Below are the settings you can use to control the use of the language server. Yo
|
|||
|
||||
- Set `go.useLanguageServer` to `true` to enable the use of language server
|
||||
- Use the setting `go.languageServerExperimentalFeatures` to control which features do you want to be powered by the language server.
|
||||
- Set `"go.languageServerFlags": ["-logfile", "path to a text file that exists"]` to collect traces in a log file.
|
||||
- Set `"go.languageServerFlags": ["-logfile", "path to a text file that exists"]` to collect logs in a log file.
|
||||
- Set `"go.languageServerFlags": ["-rpc.trace"]` to see the complete rpc trace in the output panel (`View` -> `Output` -> `gopls`)
|
||||
|
||||
#### Setting to change the language server being used
|
||||
|
||||
|
|
|
@ -111,6 +111,12 @@ export function activate(ctx: vscode.ExtensionContext): void {
|
|||
const languageServerExperimentalFeatures: any = vscode.workspace.getConfiguration('go').get('languageServerExperimentalFeatures') || {};
|
||||
const langServerFlags: string[] = vscode.workspace.getConfiguration('go')['languageServerFlags'] || [];
|
||||
|
||||
// `-trace was a flag for `go-langserver` which is replaced with `-rpc.trace` for gopls to avoid crash
|
||||
const traceFlagIndex = langServerFlags.indexOf('-trace');
|
||||
if (traceFlagIndex > -1 && languageServerTool === 'gopls') {
|
||||
langServerFlags[traceFlagIndex] = '-rpc.trace';
|
||||
}
|
||||
|
||||
const c = new LanguageClient(
|
||||
languageServerTool,
|
||||
{
|
||||
|
|
Загрузка…
Ссылка в новой задаче