Uh oh!
There was an error while loading. Please reload this page.
Adding tsconfig.json mixed content (script block) support - #12153
Conversation
b90ce31 to
da7f824Compare| } | ||
| export function createProgram(rootNames: string[], options: CompilerOptions, host?: CompilerHost, oldProgram?: Program): Program { | ||
| export function createProgram(rootNames: string[], options: CompilerOptions, host?: CompilerHost, oldProgram?: Program, fileExtensionMap?: FileExtensionMap): Program { |
There was a problem hiding this comment.
I don't think we need to push concrete knowledge about these extra extensions through all layers, this will be necessary if we'll need to be able to add files with these extensions into program via imports or tripleslash references. Since both these scenarios are not supported and files with custom extensions should always be included in the list of root files I think we can:
- revert changes in program, language service host, lsHost and services
- in editor services for configured projects if host configuration specifies extra extensions and result of cracking config files contains files with these extensions - set
allowNonTsExtensionsbit onCompilerOptionsto force adding these files into program.
this way I think we can update only project system part and keep all other layers relatively untouched.
(Note: adding this until PR #12789 is merged in so that unit tests pass)
6d2b3c5 to
5f46e48Compare| } | ||
| const result = matchFileNames(fileNames, includeSpecs, excludeSpecs, basePath, options, host, errors); | ||
| const result = matchFileNames(fileNames, includeSpecs, excludeSpecs, basePath, options, host, errors, fileExtensionMap); |
There was a problem hiding this comment.
is it not really a map anymore. maybe extraExtensions: ExtensionInfo[]?
There was a problem hiding this comment.
sounds good - will switch to extraFileExtensions: FileExtensionInfo[]
…s: FileExtensionInfo[]
| @@ -670,7 +678,7 @@ namespace ts.server { | |||
| // check if requested version is the same that we have reported last time | |||
There was a problem hiding this comment.
I would make it more like
letupdatedFileNames=this.updatedFileNames;this.updatedFileNames=undefined;/// use local updatedFileNames - this way we'll know that set of names is definitely cleared| export function getSupportedExtensions(options?: CompilerOptions): string[] { | ||
| return options && options.allowJs ? allSupportedExtensions : supportedTypeScriptExtensions; | ||
| export function getSupportedExtensions(options?: CompilerOptions, extraFileExtensions?: FileExtensionInfo[]): string[] { | ||
| let typeScriptHostExtensions: string[] = []; |
There was a problem hiding this comment.
minor nit to reduce allocations:
letallExtensions: string[];letallTypeScriptExtensions: string[];constneedAllExtensions=options&&options.allowJs;if(!extraFileExtensions){returnneedAllExtensions ? allSupportedExtensions : supportedTypeScriptExtensions;}constextensions=(needAllExtensions ? allSupportedExtensions : supportedTypeScriptExtensions).slice(0);for(constextofextraExtensions){if(!needAllExtensions||ext.scriptKind===ScriptKind.TS){extensions.push(ext.fileName);}}returnextensions;There was a problem hiding this comment.
clever - testing this change and will update
mihailik
commented
Dec 12, 2016
What is mixed content? Anders Hejlsberg (@ahejlsberg) had that tradition of decorating significant new work with a detailed summary. I don't think it is such a bad idea. |
Adding tsconfig.json mixed content (script block) support
Vladimir Matveev (@vladima): I'll work on adding tests for this now.