You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Implements #3043. A tsconfig.json file that doesn't specify a files property (and therefore implicitly references all *.ts files in all subdirectories) can now contain an exclude property that specifies a list of files and/or directories to exclude from the compilation. The exclude property must be an array of strings that each specify a file or folder name relative to the location of the tsconfig.json file. For example:
This should probably have a name that ties it more close to 'fileNames'. i.e. 'excludedFileNames'. That way we know that this is supposed to complement that tsconfig property.
The other property is called files, not fileNames. Since you can exclude both files and directories it would have to be excludedFilesAndDirectories which I think is over the top. I like the simple exclude.
I should have added more specifics. We keep all feature related code in the same directory. Unit tests are named *.spec.js Doing a build and excluding tests (or otherwise) doesn't work for us when files must be excluded by name and not by pattern.
@ahejlsberg We discussed this briefly, but I have an alternative approach that supports "glob"-style pattern matching with recursive directories in this pull request: #3232.
I suspect tsconfig.json is destined for much broader use in the future. Using the simple key exclude could become ambiguous quickly. Consider a more specific key name.
We're going with the simple exclude property for now, but we'll continue to refine #3232 with the eventual goal of supporting glob-style patterns. Anything we do in #3232 will be backwards compatible with the simple exclude list.
Does language service take exclude option into consideration? I happen to have the TS repo under node_modules/typescript and it takes a long time to autocomplete things.
I'm on VSCode 0.3 on a Mac. And I'm using the current master branch.
@rbuckton I'd like to add support for this and completely remove atom-typescript's custom filesGlob support. Can you think of any use case where a glob is still needed if exclude is supported? Don't want to do a breaking change if I'll need to reimplement it πΉ
It would be great if the exclude property supported globs. I'm sure that's been said somewhere, but I'm trying to do something similar to @Mig1st4ck and not having luck excluding files with the filesGlob property and the ! property (under the assumption that filesGlob handles the ! glob operator and excludes those files).
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Labels
None yet
16 participants
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.
Implements #3043. A tsconfig.json file that doesn't specify a
files
property (and therefore implicitly references all *.ts files in all subdirectories) can now contain anexclude
property that specifies a list of files and/or directories to exclude from the compilation. Theexclude
property must be an array of strings that each specify a file or folder name relative to the location of the tsconfig.json file. For example:The
exclude
list does not support wilcards. It must simply be a list of files and/or directories.