Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sort members enforcement in analyzer should be in a presubmit #52064

Open
jcollins-g opened this issue Apr 17, 2023 · 3 comments
Open

sort members enforcement in analyzer should be in a presubmit #52064

jcollins-g opened this issue Apr 17, 2023 · 3 comments
Labels
analyzer-server analyzer-technical-debt area-analyzer Use area-analyzer for Dart analyzer issues, including the analysis server and code completion. P3 A lower priority bug or feature request type-task A well-defined stand-alone task

Comments

@jcollins-g
Copy link
Contributor

Similar to dart format enforcement, sort members enforcement should be easy to put in a presubmit. It may be beneficial to have auto-sort on save, and a command-line displayed by the presubmit to sort members in a file.

@jcollins-g jcollins-g added area-analyzer Use area-analyzer for Dart analyzer issues, including the analysis server and code completion. analyzer-server analyzer-technical-debt labels Apr 17, 2023
@DanTup
Copy link
Collaborator

DanTup commented Apr 18, 2023

Would it make sense to have a lint/fix for this, and then it would be picked up by analysis (and can be detected/fixed with dart fix)?

In case it's useful, in VS Code it's possible to already run this on-save. I have this in my .code-workspace for the analysis server codebase:

"editor.codeActionsOnSave": {
	"source.organizeImports": true,
	"source.sortMembers": true
},

It can be a little confusing.. like you'll often add a new test in a test file somewhere and hit Save, and then watch it vanish from the screen. I've gotten used to adding @soloTest to new tests as something to quickly search for when that happens now 😄

@bwilkerson
Copy link
Member

The option for 'source.sortMembers' didn't show up for me using completion support in the settings file editor. Might have been user error, or might have been an oversight.

@DanTup
Copy link
Collaborator

DanTup commented Apr 20, 2023

The option for 'source.sortMembers' didn't show up for me using completion support in the settings file editor. Might have been user error, or might have been an oversight.

It's unfortunately a VS Code limitation - see microsoft/vscode#161284. editor.codeActionsOnSave is a standard VS Code setting and currently it doesn't take into account the code actions that individual languages have registered for the completion.

@srawlins srawlins added P3 A lower priority bug or feature request type-task A well-defined stand-alone task labels Apr 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
analyzer-server analyzer-technical-debt area-analyzer Use area-analyzer for Dart analyzer issues, including the analysis server and code completion. P3 A lower priority bug or feature request type-task A well-defined stand-alone task
Projects
None yet
Development

No branches or pull requests

4 participants