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
Add some UX to let users know that having multiple formaters is discouraged #71173
Comments
Also the status bar is very noise if I have format on save and I save every minute like people usually do. |
What status bar? We are not doing anything there |
Yes - that something we have considers. It's just not so easy because the "first" happens for different languages, e.g. different extensions, with different config stories |
For "first" can't we just say first per language per workspace. |
Just asking because prettier contributes it's own status bar message which confused people.
Ok, it seems that you have missed all standup- and water-cooler-discussion here and that you didn't read #41882. Short answer, 'no' we cannot do that, it doesn't make any sense to add another setting that effectively enables/disables formatter when all formatter already have a setting to enable/disable them. |
I actually listened to you in standups. What I meant was a storage service flag that would only influence if we should show a notificaiton via the the notifcation service. So it would not affect the actual behavior, just if we show a notification or not. |
Ok, I start to understand what you are saying... I am not a fan of showing this only once because you likely dismiss it the first time without actually reading/understanding what it said. What we could do is the following
The notification would guide you towards the extensions viewlet (maybe settings editor) and gives you a nice, stable way to configure yourself out of this. However, this doesn't really solve the issue that folks what to know what happens when multiple formatters are active and which formatter is actually being used. The status bar message is meant to be borderline annoying TBH but the its weak spot is that it doesn't guide you out of this |
Can we possibly do this, together with solving #71196:
|
That's not so easy... For once the settings editor cannot be told to show settings from a certain extensions and than there are some extensions that only format a single language. For them, having a setting doesn't make sense and you should just un-install them. |
A very common use case is you juggle through multiple repos, some using TS formatter, and some using Prettier. I don't see myself uninstalling or disabling one of them completely, even for workspace. For example they conflict on JS but Prettier has a useful JSON formatter that I always use when editing The message can be a simple message that prompts user's action (instead of doing the action itself), like |
Prettier is not a simple formatter for a single language, the css-formatter1 is and for that I would not expect a setting but I would use workspace enablement or uninstalling. The case of different projects and different formatters is interesting but I think the workspace-settings solution is flawed. Take vscode, we use the builtin TypeScript formatter. Now, you install prettier because of personal preference and/or because you use it in other projects. Now, why would it be ok that the vscode project has a setting to configure prettier? Isn't that a weird coupling? Everyone not using prettier would see a warning about an unknown setting. I really don't know a good answer to this... |
Yeah, that's the last piece to the puzzle I hope we can fill. What I really want is a workspace config that allows me to say "For *.ts file, use TS Formatter in this workspace". Otherwise each project would end up adding: {
"js-beautify.enable": false,
"prettier.enable": false,
"yet-another-popular-ts-formatter.enable": false
...
} |
This comment has been minimized.
This comment has been minimized.
After talking to @weinand and @aeschli and after understanding all the feedback and the use-cases (thanks for that) we think it's time for one more setting: Samples: ⬇️ This configures prettier to be the formatter for all things. That would also mean for foo-files even when prettier doesn't support foo-files. Because of that you likely want to configure default formatters per language... "editor.defaultFormatter": "esbenp.prettier-vscode" ⬇️ This configures beautify to be used as the only formatting option for TypeScript. If beautify isn't available or disabled somehow else then no formatting happens. "[typescript]": {
"editor.defaultFormatter": "HookyQR.beautify"
} There will be UI hints to guide you towards configuring formatters (in the presence of conflicts and absence of configuration). A notification will show when running format explicit, e.g Format Document, Format Selection, the notification will show silent (minified) when running format implicit, e.g format on save. A sample-gif! It starts with format on save and the silent notification, then comes format document and the normal notification. Notice how the configuration updates for TypeScript and how format document isn't showing notifications anymore. There is still 'format with...' which allows to pick a formatter for that one format run. It shows the default and we consider allowing to change defaults from here (as suggested by @octref) When a configured extension isn't available (didn't contribute a formatter) then we also show a notification which guides you towards using a different formatter |
I think this is a great improvement. Nice work! |
All my changes aren't yet on master but here: #71301 |
I can verify and test it more tomorrow morning if you would like. |
A few great new features here, so I added @isidorn I'll build and test it this afternoon, would be great if you can also give it a try tomorrow to catch anything I miss. |
Please verify that
|
Great job, works nice. I have created some follow up items and have linked them here so @octref can also express his opinion. |
Works great. One feedback I have is the silent notification for onsave formatting is not very discoverable. I understand the design is to not annoy people with a notification on each save, but now people can (and should) configure their way out of the multiple formatters scenario, maybe just show a notification anyway? |
Couldn't the command palette be boosted with a label above the input (that wouldn't take space if empty) so that vscode can explain what's going on while immediately jumping to action, choosing a default formatter in this case? |
@dubeg Not sure that I understand... |
Refs: #71093
If a user has multiple formatters we will always bother him to choose the one to use.
However nowhere do we say or help the user to know that having multiple formatters is discoureged and that he should disable some.
Since that is exactly what we want, and nowhere do we mention this.
The gear icon in the quick open is far fetched imho
I suggest the following but am open to more ideas:
"There are multiple formatters for this file type. Please disable one of the formatters either via settings or extensions vielwet" - and have two actions (open extensions viewlet, open user settings)
fyi @misolori
The text was updated successfully, but these errors were encountered: