Adds a script for removing unused diagnostics #44324
Conversation
| const diagName = line.split(":")[0].trim(); | ||
|
|
||
| try { | ||
| execSync(`grep -rnw 'src' -e 'Diagnostics.${diagName}'`).toString(); |
sandersn
Jun 8, 2021
Member
there's probably a platform-independent package on npm that does recursive file string search, although feature-detecting grep vs findstr would work too.
there's probably a platform-independent package on npm that does recursive file string search, although feature-detecting grep vs findstr would work too.
orta
Jun 8, 2021
Author
Member
wes thinks ripgrep ( https://www.npmjs.com/package/vscode-ripgrep ) should be a reasonable tradeoff here
wes thinks ripgrep ( https://www.npmjs.com/package/vscode-ripgrep ) should be a reasonable tradeoff here
elibarzilay
Jun 11, 2021
Member
To avoid the offensive huge cost of this you could just grep all lines that include Diagnostics., print them to a temp file, then search through this file. Also, even if the names are well behaved, it would be better to add -F. Also, -n is redundant AFAICT.
(And doing it with a grep library seems like an overkill too...)
To avoid the offensive huge cost of this you could just grep all lines that include Diagnostics., print them to a temp file, then search through this file. Also, even if the names are well behaved, it would be better to add -F. Also, -n is redundant AFAICT.
(And doing it with a grep library seems like an overkill too...)
| @@ -5793,10 +5617,6 @@ | |||
| "category": "Message", | |||
| "code": 95001 | |||
| }, | |||
| "Convert function '{0}' to class": { | |||
sandersn
Jun 8, 2021
Member
I'm almost certain this message and the ones that follow are used in codefixes. I wonder why our fourslash tests don't fail with them gone.
I'm almost certain this message and the ones that follow are used in codefixes. I wonder why our fourslash tests don't fail with them gone.
|
Well...early in a release's development is the best time to try something like this. @orta you want to try merging this early on Monday to see whether it breaks anything? (I think @elibarzilay 's right about |
|
Yeah, lets do it |

This adds a script which only runs on linux boxes, that searches the codebase for every diagnostic and lets you know if nothing is found.
TODO: Add to CI.