[typescript-language-features] Add removeUnusedImports command (#161654)

* Add `removeUnusedImports` command

* Continue to send `skipDestructiveCodeActions` for older TS versions

* Expose Sort Imports and Remove Unused Imports commands

* Update localization keys

* Update for 4.9 protocol

* Proto must be type only import?
This commit is contained in:
Andrew Branch
2022-10-18 09:00:16 -07:00
committed by GitHub
parent 4d183bd274
commit 1fb956d2f5
6 changed files with 145 additions and 24 deletions

View File

@@ -1273,6 +1273,26 @@
"command": "typescript.goToSourceDefinition",
"title": "%typescript.goToSourceDefinition%",
"category": "TypeScript"
},
{
"command": "typescript.sortImports",
"title": "%typescript.sortImports%",
"category": "TypeScript"
},
{
"command": "javascript.sortImports",
"title": "%typescript.sortImports%",
"category": "JavaScript"
},
{
"command": "typescript.removeUnusedImports",
"title": "%typescript.removeUnusedImports%",
"category": "TypeScript"
},
{
"command": "javascript.removeUnusedImports",
"title": "%typescript.removeUnusedImports%",
"category": "JavaScript"
}
],
"menus": {
@@ -1328,6 +1348,22 @@
{
"command": "typescript.goToSourceDefinition",
"when": "tsSupportsSourceDefinition && typescript.isManagedFile"
},
{
"command": "typescript.sortImports",
"when": "tsSupportsSortImports && editorLangId =~ /^typescript(react)?$/"
},
{
"command": "javascript.sortImports",
"when": "tsSupportsSortImports && editorLangId =~ /^javascript(react)?$/"
},
{
"command": "typescript.removeUnusedImports",
"when": "tsSupportsRemoveUnusedImports && editorLangId =~ /^typescript(react)?$/"
},
{
"command": "javascript.removeUnusedImports",
"when": "tsSupportsRemoveUnusedImports && editorLangId =~ /^javascript(react)?$/"
}
],
"editor/context": [