From 46999ca0246c6f76c2220fb089ff873c7187a280 Mon Sep 17 00:00:00 2001 From: Akos Kitta Date: Wed, 4 Nov 2020 12:58:28 +0100 Subject: [PATCH] Forward the compilation database path to the LS. Tha path to the compilation database is optional. Signed-off-by: Akos Kitta --- src/extension.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/extension.ts b/src/extension.ts index d724374..795ce77 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -7,6 +7,10 @@ interface LanguageServerConfig { readonly lsPath: string; readonly cliPath: string; readonly clangdPath: string; + /** + * Filesystem path pointing to the folder that contains the `compile_commands.json` file. + */ + readonly compileCommandsPath?: string; readonly board: { readonly fqbn: string; readonly name?: string; @@ -55,11 +59,14 @@ function buildLanguageClient(config: LanguageServerConfig): LanguageClient { if (!serverTraceChannel) { serverTraceChannel = vscode.window.createOutputChannel('Arduino Language Server (trace)'); } - const { lsPath: command, clangdPath, cliPath, board, flags, env } = config; + const { lsPath: command, clangdPath, cliPath, board, flags, env, compileCommandsPath } = config; const args = ['-clangd', clangdPath, '-cli', cliPath, '-fqbn', board.fqbn]; if (board.name) { args.push('-board-name', board.name); } + if (compileCommandsPath) { + args.push('-compile-commands-dir', compileCommandsPath); + } if (flags && flags.length) { args.push(...flags); }