chrmarti / vscode-regex

MIT License
157 stars 33 forks source link

Make regex detection configurable by Language Mode #59

Open MarttiR opened 1 year ago

MarttiR commented 1 year ago

There are a lot of requests for supporting new file types.

One way to do that would be to make vscode-regex configuration overrideable by Language Mode.

For example, for bash, one could add detection for common sed and grep patterns, the first capturing group containing the regex:

"[shellscript]": {
  "vscode-regex.enable": true,
  "vscode-regex.detectionPatterns": [
    "sed.*?\"s/(.*?)/",
    "sed.*?\"s#(.*?)#",
    "grep.*?\"(.*?)\"",
  ],
},

Such configuration properties can be created by setting the scope property to language-overridable.

This would enable users themselves to add support for whatever they need.

Consider also supporting a specifically named capturing group inside a detectionPattern.