@@ -7,6 +7,10 @@ interface LanguageServerConfig {
7
7
readonly lsPath : string ;
8
8
readonly cliPath : string ;
9
9
readonly clangdPath : string ;
10
+ /**
11
+ * Filesystem path pointing to the folder that contains the `compile_commands.json` file.
12
+ */
13
+ readonly compileCommandsPath ?: string ;
10
14
readonly board : {
11
15
readonly fqbn : string ;
12
16
readonly name ?: string ;
@@ -55,11 +59,14 @@ function buildLanguageClient(config: LanguageServerConfig): LanguageClient {
55
59
if ( ! serverTraceChannel ) {
56
60
serverTraceChannel = vscode . window . createOutputChannel ( 'Arduino Language Server (trace)' ) ;
57
61
}
58
- const { lsPath : command , clangdPath, cliPath, board, flags, env } = config ;
62
+ const { lsPath : command , clangdPath, cliPath, board, flags, env, compileCommandsPath } = config ;
59
63
const args = [ '-clangd' , clangdPath , '-cli' , cliPath , '-fqbn' , board . fqbn ] ;
60
64
if ( board . name ) {
61
65
args . push ( '-board-name' , board . name ) ;
62
66
}
67
+ if ( compileCommandsPath ) {
68
+ args . push ( '-compile-commands-dir' , compileCommandsPath ) ;
69
+ }
63
70
if ( flags && flags . length ) {
64
71
args . push ( ...flags ) ;
65
72
}
0 commit comments