mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-30 01:04:49 -05:00
Add propertybag to parsed tsconfig.json file.
This allows consumers of the LS to read properties added to the tsconfig.json without having to worry about dealing with comments.
This commit is contained in:
@@ -664,6 +664,22 @@ namespace ts {
|
||||
const compilerOptions: CompilerOptions = convertCompilerOptionsFromJsonWorker(json["compilerOptions"], basePath, errors, configFileName);
|
||||
const options = extend(existingOptions, compilerOptions);
|
||||
const typingOptions: TypingOptions = convertTypingOptionsFromJsonWorker(json["typingOptions"], basePath, errors, configFileName);
|
||||
|
||||
// Contains the properties on the json we don't recognize, but the
|
||||
// host might so we return them as a property bag. This allows the host to handle
|
||||
// them, but doesn't have to deal with removing comments from the source json.
|
||||
const other: any = {};
|
||||
|
||||
const knownProperties = ["compilerOptions", "typingOptions", "files", "exclude"];
|
||||
|
||||
for (const prop in json) {
|
||||
if (knownProperties.indexOf(prop) >= 0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
other[prop] = json[prop];
|
||||
}
|
||||
|
||||
options.configFilePath = configFileName;
|
||||
|
||||
const fileNames = getFileNames(errors);
|
||||
@@ -672,6 +688,7 @@ namespace ts {
|
||||
options,
|
||||
fileNames,
|
||||
typingOptions,
|
||||
other,
|
||||
errors
|
||||
};
|
||||
|
||||
|
||||
@@ -2592,6 +2592,7 @@ namespace ts {
|
||||
options: CompilerOptions;
|
||||
typingOptions?: TypingOptions;
|
||||
fileNames: string[];
|
||||
other?: any;
|
||||
errors: Diagnostic[];
|
||||
}
|
||||
|
||||
|
||||
@@ -997,6 +997,7 @@ namespace ts {
|
||||
options: {},
|
||||
typingOptions: {},
|
||||
files: [],
|
||||
other: {},
|
||||
errors: [realizeDiagnostic(result.error, "\r\n")]
|
||||
};
|
||||
}
|
||||
@@ -1008,6 +1009,7 @@ namespace ts {
|
||||
options: configFile.options,
|
||||
typingOptions: configFile.typingOptions,
|
||||
files: configFile.fileNames,
|
||||
other: configFile.other,
|
||||
errors: realizeDiagnostics(configFile.errors, "\r\n")
|
||||
};
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user