feat: allow explicit ScriptKind extraFileExtensions #60178
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
When configuring the language service host with extra file extensions, the file extension is only regarded as supported if its
Deferred
or like JS. If the host can delare a specific ScriptKind such asTSX
for a file then it will be stripped out with getSupportedExtensions.This then later causes the programs rootFiles to not include the extra file extension, and thus be excluded from the program.
If using
Deferred
then the file when parsed will be treated as TS and fail to compile when using (J)TSX syntax. In majority of cases the script kind will be known by the consumer and they can set the explicit script kind for the extra file extension.Adjust the logic for
getSupportedExtensions
to include any extra file extension that are not built in. This way all explicit extra file extensions added will be included in the project/programs root files and an explicitscriptKind
can be set.Fixes #60125