mirror of
https://github.com/arduino/arduino-ide.git
synced 2025-07-09 12:26:34 +00:00
GH-393: Do not use clangd
from the $PATH
.
Closes: arduino/arduino-pro-ide#393 Signed-off-by: Akos Kitta <kittaakos@typefox.io>
This commit is contained in:
parent
00a3ee34c8
commit
258b1e903e
@ -1,6 +1,3 @@
|
||||
import * as fs from 'fs';
|
||||
import * as os from 'os';
|
||||
import { join } from 'path';
|
||||
import { ContainerModule } from 'inversify';
|
||||
import { ArduinoDaemonImpl } from './arduino-daemon-impl';
|
||||
import { ILogger } from '@theia/core/lib/common/logger';
|
||||
@ -128,21 +125,6 @@ export default new ContainerModule((bind, unbind, isBound, rebind) => {
|
||||
});
|
||||
}));
|
||||
|
||||
// Set up cpp extension
|
||||
if (!process.env.CPP_CLANGD_COMMAND) {
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
// File-system extension for mapping paths to URIs
|
||||
bind(NodeFileSystemExt).toSelf().inSingletonScope();
|
||||
bind(FileSystemExt).toService(NodeFileSystemExt);
|
||||
|
@ -4,7 +4,12 @@ import * as semver from 'semver';
|
||||
import { join } from 'path';
|
||||
import { spawn } from 'child_process';
|
||||
|
||||
export async function getExecPath(commandName: string, onError: (error: Error) => void = (error) => console.log(error), versionArg?: string, inBinDir?: boolean): Promise<string> {
|
||||
export async function getExecPath(
|
||||
commandName: string,
|
||||
onError: (error: Error) => void = (error) => console.log(error),
|
||||
versionArg?: string | undefined,
|
||||
inBinDir?: boolean): Promise<string> {
|
||||
|
||||
const execName = `${commandName}${os.platform() === 'win32' ? '.exe' : ''}`;
|
||||
const relativePath = ['..', '..', 'build'];
|
||||
if (inBinDir) {
|
||||
|
@ -14,7 +14,7 @@ export class ExecutableServiceImpl implements ExecutableService {
|
||||
async list(): Promise<{ clangdUri: string, cliUri: string, lsUri: string }> {
|
||||
const [ls, clangd, cli] = await Promise.all([
|
||||
getExecPath('arduino-language-server', this.onError.bind(this)),
|
||||
getExecPath('clangd', this.onError.bind(this), '--version', os.platform() !== 'win32'),
|
||||
getExecPath('clangd', this.onError.bind(this), undefined, os.platform() !== 'win32'),
|
||||
getExecPath('arduino-cli', this.onError.bind(this))
|
||||
]);
|
||||
return {
|
||||
|
Loading…
x
Reference in New Issue
Block a user