Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 141a3f6

Browse files
Merge pull request #2 from arduino/compile_commands
Forward the compilation database path to the LS.
2 parents a6a24ca + 46999ca commit 141a3f6

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

‎src/extension.ts‎

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ interface LanguageServerConfig {
77
readonly lsPath: string;
88
readonly cliPath: string;
99
readonly clangdPath: string;
10+
/**
11+
* Filesystem path pointing to the folder that contains the `compile_commands.json` file.
12+
*/
13+
readonly compileCommandsPath?: string;
1014
readonly board: {
1115
readonly fqbn: string;
1216
readonly name?: string;
@@ -55,11 +59,14 @@ function buildLanguageClient(config: LanguageServerConfig): LanguageClient {
5559
if (!serverTraceChannel) {
5660
serverTraceChannel = vscode.window.createOutputChannel('Arduino Language Server (trace)');
5761
}
58-
const { lsPath: command, clangdPath, cliPath, board, flags, env } = config;
62+
const { lsPath: command, clangdPath, cliPath, board, flags, env, compileCommandsPath } = config;
5963
const args = ['-clangd', clangdPath, '-cli', cliPath, '-fqbn', board.fqbn];
6064
if (board.name) {
6165
args.push('-board-name', board.name);
6266
}
67+
if (compileCommandsPath) {
68+
args.push('-compile-commands-dir', compileCommandsPath);
69+
}
6370
if (flags && flags.length) {
6471
args.push(...flags);
6572
}

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /