Skip to content

Forward the compilation database path to the LS. #2

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 4, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
}
Expand Down