| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
|
Thanks for the PR! It looks like you've changed the TSServer protocol in some way. Please ensure that any changes here don't break consumers of the current TSServer API. For some extra review, we'll ping Sheetal Nandi (@sheetalkamat), Andrew Casey (@amcasey), Matt Bierner (@mjbvz), Mine Starks (@minestarks) for you. Feel free to loop in other consumers/maintainers if necessary |
Sorry, something went wrong.
| /** @deprecated Use `mode` instead */ | ||
| skipDestructiveCodeActions?: boolean; | ||
| mode?: OrganizeImportsMode; |
There was a problem hiding this comment.
I think skipDestructiveCodeActions was vaguely named due to aspirations of being used in more than one place, but it didn’t end up that way. FWIW, VS never picked this argument up, so it’s likely only VS Code that uses it.
Sorry, something went wrong.
|
|
||
| export const enum OrganizeImportsMode { | ||
| All = "All", | ||
| SortAndCombine = "SortAndCombine", |
There was a problem hiding this comment.
While the PR focuses on the RemoveUnused... I'm more excited about SortAndCombine :P I see that skipDestructiveCodeActions was a thing (didn't know about it), gonna give it a try in my projects for now
Sorry, something went wrong.
There was a problem hiding this comment.
Yeah, to be clear, SortAndCombine ought to be identical to setting skipDestructiveCodeActions which is already set in a VS Code code action called sortImports. (It’s not very discoverable because I learned recently that these code actions lack autocomplete support in the VS Code settings.json files.)
Sorry, something went wrong.
There was a problem hiding this comment.
Ye, I got the fact that this one isn't a new option - but I had no idea that it was already a thing. So I'm glad that I've discovered that old option through this PR :P
Sorry, something went wrong.
There was a problem hiding this comment.
I can't figure out how to actually use this old option in VS Code. I've found this in the source code:
https://github.com/microsoft/vscode/blob/3a8b1fe03ebbcf57fb9c50b161db91229e2fe04a/extensions/typescript-language-features/src/languageFeatures/organizeImports.ts#L50
I've tried a lot of combinations with _typescript.*, typescript.*, source.* and *.organizeImports.sortOnly: true but none of those work for me.
Sorry, something went wrong.
There was a problem hiding this comment.
"editor.codeActionsOnSave": {
"source.sortImports": true
}
Sorry, something went wrong.
There was a problem hiding this comment.
I believe Organize Imports is a VS Code standard command, and so automatically appears in the command palette when registered. These variations are registered so can be triggered by ID in configurations like codeActionsOnSave, but I think we would need to add them to the contributes of the extension package.json to show up in the command palette. Matt Bierner (@mjbvz) is that correct?
Sorry, something went wrong.
There was a problem hiding this comment.
LGTM, though the enum structure feels forced.
Sorry, something went wrong.
|
how do we use a specific mode in our settings.json ? Are we supposed to do something like: "editor.codeActionsOnSave": {
"source.sortImports": 'all',
}? |
Sorry, something went wrong.
|
The command names are source.organizeImports, source.removeUnusedImports, and source.sortImports. |
Sorry, something went wrong.
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
Fixes #43141