Skip to content

Commit 68b8965

Browse files
authored
Merge pull request #1420 from Microsoft/bobbrow/split-paths
move path-splitting code into TypeScript and add support for browse.path
2 parents c728178 + 484051c commit 68b8965

File tree

1 file changed

+18
-14
lines changed

1 file changed

+18
-14
lines changed

Extension/src/LanguageServer/configurations.ts

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -274,25 +274,29 @@ export class CppProperties {
274274
this.onSelectionChanged();
275275
}
276276

277+
private resolveAndSplit(paths: string[]): string[] {
278+
let result: string[] = [];
279+
paths.forEach(entry => {
280+
let entries: string[] = util.resolveVariables(entry).split(";").filter(e => e);
281+
result = result.concat(entries);
282+
});
283+
return result;
284+
}
285+
277286
private updateServerOnFolderSettingsChange(): void {
278287
for (let i: number = 0; i < this.configurationJson.configurations.length; i++) {
279-
if (this.configurationJson.configurations[i].includePath !== undefined) {
280-
for (let j: number = 0; j < this.configurationJson.configurations[i].includePath.length; j++) {
281-
this.configurationJson.configurations[i].includePath[j] = util.resolveVariables(this.configurationJson.configurations[i].includePath[j]);
282-
}
288+
let configuration: Configuration = this.configurationJson.configurations[i];
289+
if (configuration.includePath !== undefined) {
290+
configuration.includePath = this.resolveAndSplit(configuration.includePath);
283291
}
284-
if (this.configurationJson.configurations[i].browse !== undefined && this.configurationJson.configurations[i].browse.path !== undefined) {
285-
for (let j: number = 0; j < this.configurationJson.configurations[i].browse.path.length; j++) {
286-
this.configurationJson.configurations[i].browse.path[j] = util.resolveVariables(this.configurationJson.configurations[i].browse.path[j]);
287-
}
292+
if (configuration.browse !== undefined && configuration.browse.path !== undefined) {
293+
configuration.browse.path = this.resolveAndSplit(configuration.browse.path);
288294
}
289-
if (this.configurationJson.configurations[i].macFrameworkPath !== undefined) {
290-
for (let j: number = 0; j < this.configurationJson.configurations[i].macFrameworkPath.length; j++) {
291-
this.configurationJson.configurations[i].macFrameworkPath[j] = util.resolveVariables(this.configurationJson.configurations[i].macFrameworkPath[j]);
292-
}
295+
if (configuration.macFrameworkPath !== undefined) {
296+
configuration.macFrameworkPath = this.resolveAndSplit(configuration.macFrameworkPath);
293297
}
294-
if (this.configurationJson.configurations[i].compileCommands !== undefined) {
295-
this.configurationJson.configurations[i].compileCommands = util.resolveVariables(this.configurationJson.configurations[i].compileCommands);
298+
if (configuration.compileCommands !== undefined) {
299+
configuration.compileCommands = util.resolveVariables(configuration.compileCommands);
296300
}
297301
}
298302

0 commit comments

Comments
 (0)