1

When using the VS Code API, files within the workspace can be searched for with the findFiles() function, in the workspace API. According to the documentation, it takes a GlobPattern as an input pattern parameter.

I would prefer to use RegEx to find files within the workspace; is such an equivalent available in the API?

kosude
  • 177
  • 3
  • 14
  • see: [Find a file by name with regex in VSCode](https://stackoverflow.com/questions/60994181/find-a-file-by-name-with-regex-in-vscode) – Luuk Apr 13 '23 at 11:32
  • @Luuk, unfortunately this did not answer the question. That question is referring to the user interface, not the API, and the answer they got also just referred to using glob patterns instead. – kosude Apr 13 '23 at 11:55
  • Considering the [GH issue](https://github.com/microsoft/vscode/issues/127723) they created, it doesn't seem like there is functionality for this currently, but I have commented on it to hopefully promote its implementation. I will put this into an answer for now, unless I'm missing something. – kosude Apr 13 '23 at 11:57

2 Answers2

0

Currently, it unfortunately doesn't seem like this is a planned feature. I've +1'ed the issue on GH in some attempt to hopefully revive it, but unless I'm missing something, it looks like a dead end for now.

kosude
  • 177
  • 3
  • 14
0

If there's no ready-to-use API then do it yourself. Retrieve all file paths and match each of them with your regex. Glob does actually the same, only the way it matches each file path is different.

Mike Lischke
  • 48,925
  • 16
  • 119
  • 181