Skip to content

Commit 258b1e9

Browse files
Akos Kittakittaakos
Akos Kitta
authored andcommitted
GH-393: Do not use clangd from the $PATH.
Closes: arduino/arduino-pro-ide#393 Signed-off-by: Akos Kitta <[email protected]>
1 parent 00a3ee3 commit 258b1e9

File tree

3 files changed

+7
-20
lines changed

3 files changed

+7
-20
lines changed

Diff for: arduino-ide-extension/src/node/arduino-ide-backend-module.ts

-18
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
import * as fs from 'fs';
2-
import * as os from 'os';
3-
import { join } from 'path';
41
import { ContainerModule } from 'inversify';
52
import { ArduinoDaemonImpl } from './arduino-daemon-impl';
63
import { ILogger } from '@theia/core/lib/common/logger';
@@ -128,21 +125,6 @@ export default new ContainerModule((bind, unbind, isBound, rebind) => {
128125
});
129126
}));
130127

131-
// Set up cpp extension
132-
if (!process.env.CPP_CLANGD_COMMAND) {
133-
const segments = ['..', '..', 'build'];
134-
if (os.platform() === 'win32') {
135-
segments.push('clangd.exe');
136-
} else {
137-
segments.push('bin');
138-
segments.push('clangd');
139-
}
140-
const clangdCommand = join(__dirname, ...segments);
141-
if (fs.existsSync(clangdCommand)) {
142-
process.env.CPP_CLANGD_COMMAND = clangdCommand;
143-
}
144-
}
145-
146128
// File-system extension for mapping paths to URIs
147129
bind(NodeFileSystemExt).toSelf().inSingletonScope();
148130
bind(FileSystemExt).toService(NodeFileSystemExt);

Diff for: arduino-ide-extension/src/node/exec-util.ts

+6-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,12 @@ import * as semver from 'semver';
44
import { join } from 'path';
55
import { spawn } from 'child_process';
66

7-
export async function getExecPath(commandName: string, onError: (error: Error) => void = (error) => console.log(error), versionArg?: string, inBinDir?: boolean): Promise<string> {
7+
export async function getExecPath(
8+
commandName: string,
9+
onError: (error: Error) => void = (error) => console.log(error),
10+
versionArg?: string | undefined,
11+
inBinDir?: boolean): Promise<string> {
12+
813
const execName = `${commandName}${os.platform() === 'win32' ? '.exe' : ''}`;
914
const relativePath = ['..', '..', 'build'];
1015
if (inBinDir) {

Diff for: arduino-ide-extension/src/node/executable-service-impl.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ export class ExecutableServiceImpl implements ExecutableService {
1414
async list(): Promise<{ clangdUri: string, cliUri: string, lsUri: string }> {
1515
const [ls, clangd, cli] = await Promise.all([
1616
getExecPath('arduino-language-server', this.onError.bind(this)),
17-
getExecPath('clangd', this.onError.bind(this), '--version', os.platform() !== 'win32'),
17+
getExecPath('clangd', this.onError.bind(this), undefined, os.platform() !== 'win32'),
1818
getExecPath('arduino-cli', this.onError.bind(this))
1919
]);
2020
return {

0 commit comments

Comments
 (0)