lsp: add settings to customize the logging location (#123)

This commit is contained in:
Tyler Wilding 2022-10-10 00:45:31 -04:00 committed by GitHub
parent 684d91b1f9
commit accf8e4224
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 24 additions and 12 deletions

View file

@ -211,18 +211,24 @@
"title": "LSP",
"properties": {
"opengoal.launchLspOnStartup": {
"type": [
"boolean"
],
"type": "boolean",
"default": true,
"description": "Whether or not the LSP should be started automatically"
},
"opengoal.opengoalLspPath": {
"type": [
"string"
],
"type": "string",
"default": "",
"description": "Hardcode a path to the LSP executable"
},
"opengoal.opengoalLspLogPath": {
"type": "string",
"default": "",
"description": "Provide a path that the LSP should log it's debugging info to"
},
"opengoal.opengoalLspLogVerbose": {
"type": "boolean",
"default": "",
"description": "Should the LSP logging be verbose?"
}
}
},

View file

@ -7,6 +7,9 @@ export function getConfig() {
launchLspOnStartup: configOptions.get<boolean>("launchLspOnStartup"),
opengoalLspVersion: configOptions.get<string>("opengoalLspVersion"),
opengoalLspPath: configOptions.get<string>("opengoalLspPath"),
opengoalLspLogPath: configOptions.get<string>("opengoalLspLogPath"),
opengoalLspLogVerbose: configOptions.get<boolean>("opengoalLspLogVerbose"),
eeManPagePath: configOptions.get<string>("eeManPagePath"),
vuManPagePath: configOptions.get<string>("vuManPagePath"),
decompilerPath: configOptions.get<string>("decompilerPath"),

View file

@ -120,20 +120,23 @@ async function maybeDownloadLspServer(): Promise<void> {
}
function createClient(lspPath: string): LanguageClient {
const logPath =
getConfig().opengoalLspLogPath ??
path.join(extensionContext.extensionPath, "lsp.log");
const normalArgs = ["--log", logPath];
if (getConfig().opengoalLspLogVerbose) {
normalArgs.push("--verbose");
}
const serverOptions: ServerOptions = {
run: {
command: lspPath,
transport: TransportKind.stdio,
args: ["--log", path.join(extensionContext.extensionPath, "lsp.log")],
args: normalArgs,
},
debug: {
command: lspPath,
transport: TransportKind.stdio,
args: [
"--verbose",
"--log",
path.join(extensionContext.extensionPath, "lsp.log"),
],
args: ["--verbose", "--log", logPath],
},
};
const clientOptions: LanguageClientOptions = {