Merge pull request #1652 from Microsoft/master

merge master
This commit is contained in:
Bob Brown 2018-03-08 08:59:51 -08:00 коммит произвёл GitHub
Родитель 42698a85cd 17d19a93e0
Коммит 3ca02dac55
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
1 изменённых файлов: 16 добавлений и 22 удалений

Просмотреть файл

@ -187,25 +187,6 @@ export class CppProperties {
this.defaultIncludes = compilerDefaults.includes;
this.defaultFrameworks = compilerDefaults.frameworks;
// Update the compilerPath, cStandard, and cppStandard with the default being used.
let doUpdate: boolean = false;
let config: Configuration = this.configurationJson.configurations[this.CurrentConfiguration];
if (this.defaultCompilerPath && this.defaultCompilerPath.length > 0 && (!config.compilerPath || config.compilerPath.length === 0)) {
config.compilerPath = this.defaultCompilerPath;
doUpdate = true;
}
if (this.defaultCStandard && this.defaultCStandard.length > 0 && (!config.cStandard || config.cStandard.length === 0)) {
config.cStandard = this.defaultCStandard;
doUpdate = true;
}
if (this.defaultCppStandard && this.defaultCppStandard.length > 0 && (!config.cppStandard || config.cppStandard.length === 0)) {
config.cppStandard = this.defaultCppStandard;
doUpdate = true;
}
if (doUpdate && this.propertiesFile) {
fs.writeFileSync(this.propertiesFile.fsPath, JSON.stringify(this.configurationJson, null, 4));
}
// defaultPaths is only used when there isn't a c_cpp_properties.json, but we don't send the configuration changed event
// to the language server until the default include paths and frameworks have been sent.
this.handleConfigurationChange();
@ -239,9 +220,7 @@ export class CppProperties {
if (process.platform === 'darwin') {
this.configurationJson.configurations[this.CurrentConfiguration].macFrameworkPath = this.defaultFrameworks;
}
if (this.defaultCompilerPath) {
this.configurationJson.configurations[this.CurrentConfiguration].compilerPath = this.defaultCompilerPath;
}
this.configurationJson.configurations[this.CurrentConfiguration].compilerPath = this.defaultCompilerPath;
if (this.defaultCStandard) {
this.configurationJson.configurations[this.CurrentConfiguration].cStandard = this.defaultCStandard;
}
@ -482,6 +461,21 @@ export class CppProperties {
}
}
// Update the compilerPath, cStandard, and cppStandard with the default if they're missing.
let config: Configuration = this.configurationJson.configurations[this.CurrentConfiguration];
if (!config.compilerPath) {
config.compilerPath = this.defaultCompilerPath;
dirty = true;
}
if (!config.cStandard) {
config.cStandard = this.defaultCStandard;
dirty = true;
}
if (!config.cppStandard) {
config.cppStandard = this.defaultCppStandard;
dirty = true;
}
if (dirty) {
fs.writeFileSync(this.propertiesFile.fsPath, JSON.stringify(this.configurationJson, null, 4));
}