From 7f22bbe4596c21f301d791b9073dabd0743b72e8 Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Sun, 4 Aug 2024 20:57:16 -0400 Subject: [PATCH] Add clangd.env config key Useful to flexibly modify the behavior of clangd, i.e. to set the default locale --- package.json | 5 +++++ src/clangd-context.ts | 5 ++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index ab47ae4..01e04f9 100644 --- a/package.json +++ b/package.json @@ -141,6 +141,11 @@ "default": false, "description": "Check for language server updates on startup." }, + "clangd.env": { + "type": "object", + "default": {}, + "description": "Additional environment variables to be defined for the clangd server." + }, "clangd.onConfigChanged": { "type": "string", "default": "prompt", diff --git a/src/clangd-context.ts b/src/clangd-context.ts index 9fc40a4..daa8a5b 100644 --- a/src/clangd-context.ts +++ b/src/clangd-context.ts @@ -69,7 +69,10 @@ export class ClangdContext implements vscode.Disposable { const clangd: vscodelc.Executable = { command: clangdPath, args: await config.get('arguments'), - options: {cwd: vscode.workspace.rootPath || process.cwd()} + options: { + cwd: vscode.workspace.rootPath || process.cwd(), + env: await config.get('env') + } }; const traceFile = config.get('trace'); if (!!traceFile) {