question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Support regex in files.exclude => when

See original GitHub issue

I would like to ignore JS files in my project when there’s a matching TS or matching TSX file. Right now I have to choose one or the other. Please support making the “when” directive in the “files.exclude” workspace setting use a regex, so I could do this:

{
  "files.exclude": {
        "**/*.js": { "when": "$(basename).tsx?"},
  }
}

Issue Analytics

  • State:open
  • Created 8 years ago
  • Reactions:50
  • Comments:12 (2 by maintainers)

github_iconTop GitHub Comments

25reactions
egammacommented, Dec 12, 2015

There is a work around 😄. Define define different regular expression that matches the same files:

{
    "files.exclude": {
        "**/*.js": { "when": "$(basename).ts"},
        "**/*?.js": { "when": "$(basename).tsx"}
    }
}

@bpasero can you pls check that we cover when in our docs.

6reactions
sparebytescommented, Mar 6, 2017

I would like to ignore *.d.ts when there is a corresponding .ts file. Unfortunately this rule just hides all d.ts files:

"src/**/*.d.ts": { "when": "$(basename).ts" },

Apparently, $(basename) doesn’t match the * in *.d.ts but instead matches *.dt. This could be fixed using regular expressions (negative lookahead). A new variable like $(matchedname) might solve it but I see other problems with that approach.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Regular expression for excluding file types .exe and .js
The regular expression is working with some small issue. When I am adding more than one exe file then the tool is not...
Read more >
Exclude or filter files using file type and regular expressions ...
Open the Code42 app. · Select settings button Settings. · Select Backup Sets. · Next to File Exclusions, select Change. · Enter a...
Read more >
How Do I Exclude Files Using Regular Expressions? - Rigor
How Do I Exclude Files Using Regular Expressions? · Edit Real Browser Check > Advanced > + Add Excluded File · From the...
Read more >
RegEx Files and Directories Exclusion - Akeeba Backup
You are supposed to specify a full regular expression, including its opening and ending separators. · The application supports an extension to the...
Read more >
How to exclude Test files From Searches in VS Code?
Search in VS Code doesn't utilize regex in excluding files (see open issue). It is configured with glob patterns.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found