Skip to content

Update Language Server flags #28

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 3 commits into from
Jan 13, 2022
Merged
Changes from 1 commit
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
12 changes: 6 additions & 6 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ import { LanguageClient, CloseAction, ErrorAction, InitializeError, Message, Rev

interface LanguageServerConfig {
readonly lsPath: string;
readonly cliPath: string;
readonly cliConfigPath: string;
readonly cliDaemonAddr: string;
readonly cliDaemonInstance: string;
readonly clangdPath: string;
readonly board: {
readonly fqbn: string;
Expand All @@ -29,7 +29,7 @@ interface LanguageServerConfig {
}

interface DebugConfig {
readonly cliPath: string;
readonly cliDaemonAddr: string;
readonly board: {
readonly fqbn: string;
readonly name?: string;
Expand Down Expand Up @@ -103,7 +103,7 @@ async function startDebug(_: ExtensionContext, config: DebugConfig): Promise<boo
let rawStdErr: string | undefined = undefined;
try {
const args = ['debug', '-I', '-b', config.board.fqbn, config.sketchPath, '--format', 'json'];
const { stdout, stderr } = spawnSync(config.cliPath, args, { encoding: 'utf8' });
const { stdout, stderr } = spawnSync(config.cliDaemonAddr, args, { encoding: 'utf8' });
rawStdout = stdout.trim();
rawStdErr = stderr.trim();
} catch (err) {
Expand Down Expand Up @@ -188,8 +188,8 @@ async function startLanguageServer(context: ExtensionContext, config: LanguageSe
}

async function buildLanguageClient(config: LanguageServerConfig): Promise<LanguageClient> {
const { lsPath: command, clangdPath, cliPath, cliConfigPath, board, flags, env, log } = config;
const args = ['-clangd', clangdPath, '-cli', cliPath, '-cli-config', cliConfigPath, '-fqbn', board.fqbn];
const { lsPath: command, clangdPath, cliDaemonAddr, cliDaemonInstance, board, flags, env, log } = config;
const args = ['-clangd', clangdPath, '-cli-daemon-addr', cliDaemonAddr, '-cli-daemon-instance', cliDaemonInstance, '-fqbn', board.fqbn];
if (board.name) {
args.push('-board-name', board.name);
}
Expand Down