-
Notifications
You must be signed in to change notification settings - Fork 13k
tsconfig parsing in Language Service #2877
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
add a callback to enumerate files in a directory
@@ -299,7 +299,7 @@ module ts { | |||
* @param basePath A root directory to resolve relative path entries in the config | |||
* file to. e.g. outDir | |||
*/ | |||
export function parseConfigFile(json: any, basePath?: string): ParsedCommandLine { | |||
export function parseConfigFile(json: any, host: ParseConfigHost, basePath?: string): ParsedCommandLine { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
make basePath required.
Please use readConfigFile instead of another JSON.parse |
return { | ||
options: {}, | ||
files: [], | ||
errors: [realizeDiagnostic(result.error, '/r/n')] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ooops.
@@ -188,6 +194,7 @@ module ts { | |||
|
|||
export interface CoreServicesShim extends Shim { | |||
getPreProcessedFileInfo(fileName: string, sourceText: IScriptSnapshot): string; | |||
getTSConfigFileInfo(fileName: string, sourceText: IScriptSnapshot): string; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
getConfigFileInfo and lose the TS part
Thanks 👍 |
try { | ||
var text = sys.readFile(fileName); | ||
return /\S/.test(text) ? JSON.parse(text) : {}; | ||
return parseConfigFileText(fileName, text); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this needs to move out of the try.
This adds a method to the language service to parse a tsconfig file and correctly calculate the initial collection of files to consider. We expect the 'host' to find the files in the file system.
This adds a method to the language service to parse a tsconfig file and correctly calculate the initial collection of files to consider.
We expect the 'host' to find the files in the file system.