arduino/arduino-pro-ide#31: Include clangd for linux with 'bin' and 'lib' folders

This commit is contained in:
Miro Spönemann
2020-01-10 11:02:23 +01:00
parent b8fdb03433
commit bef9185c6c
5 changed files with 79 additions and 25 deletions

View File

@@ -24,8 +24,8 @@ export class ArduinoLanguageServerContribution extends BaseLanguageServerContrib
}
async start(clientConnection: IConnection, options: LanguageServerStartOptions): Promise<void> {
const clangd = await this.resolveExecutable('clangd');
const languageServer = await this.resolveExecutable('arduino-language-server');
const clangd = await this.resolveExecutable('clangd');
const cli = await this.resolveExecutable('arduino-cli');
// Add '-log' argument to enable logging to files
const args: string[] = ['-clangd', clangd, '-cli', cli];
@@ -47,7 +47,11 @@ export class ArduinoLanguageServerContribution extends BaseLanguageServerContrib
protected resolveExecutable(name: string): Promise<string> {
return new Promise<string>((resolve, reject) => {
const path = `${process.env.PATH}${delimiter}${join(__dirname, '..', '..', '..', 'build')}`;
const segments = ['..', '..', '..', 'build'];
if (name === 'clangd' && os.platform() !== 'win32') {
segments.push('bin');
}
const path = `${process.env.PATH}${delimiter}${join(__dirname, ...segments)}`;
const suffix = os.platform() === 'win32' ? '.exe' : '';
which(name + suffix, { path }, (err, execPath) => {
if (err) {