mirror of
https://github.com/arduino/arduino-ide.git
synced 2025-11-10 02:48:33 +00:00
arduino/arduino-pro-ide#31: Include clangd for linux with 'bin' and 'lib' folders
This commit is contained in:
@@ -64,7 +64,7 @@ export default new ContainerModule((bind, unbind, isBound, rebind) => {
|
||||
bindBackendService(SketchesServicePath, SketchesService);
|
||||
});
|
||||
bind(ConnectionContainerModule).toConstantValue(sketchesServiceConnectionModule);
|
||||
|
||||
|
||||
// Config service
|
||||
bind(ConfigServiceImpl).toSelf().inSingletonScope();
|
||||
bind(ConfigService).toService(ConfigServiceImpl);
|
||||
@@ -161,8 +161,14 @@ export default new ContainerModule((bind, unbind, isBound, rebind) => {
|
||||
|
||||
// Set up cpp extension
|
||||
if (!process.env.CPP_CLANGD_COMMAND) {
|
||||
const executable = os.platform() === 'win32' ? 'clangd.exe' : 'clangd';
|
||||
const clangdCommand = join(__dirname, '..', '..', 'build', executable);
|
||||
const segments = ['..', '..', 'build'];
|
||||
if (os.platform() === 'win32') {
|
||||
segments.push('clangd.exe');
|
||||
} else {
|
||||
segments.push('bin');
|
||||
segments.push('clangd');
|
||||
}
|
||||
const clangdCommand = join(__dirname, ...segments);
|
||||
if (fs.existsSync(clangdCommand)) {
|
||||
process.env.CPP_CLANGD_COMMAND = clangdCommand;
|
||||
}
|
||||
|
||||
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user