How to formate code in Visual Studio?
I press the button or shortcut to format Document and says it's ready, for me it's a big mess. I would like a linter for everyone who's working in the project.
11 Replies
$prettycode
To format your code in Visual Studio, Visual Studio Code, Rider, use the following shortcut:
NOTE: the first key must be held while doing it.
https://cdn.discordapp.com/attachments/569261465463160900/899513918567890944/2021-10-18_01-26-35.gif
C# doesn't really have that big of an ecosystem of formatters and linters
You have Roslyn analyzers for linters
And
dotnet format
for formatting
And... that's basically itThanks for replying, but... It's still not working, the only thing I see changed is the spacing between words.
I use the control + k -> D, also Shift + alt + f, also the UI button, all of them have the same result. Only spacing.
Weird
Yup, making it unusable for me, I even prefer vscode
$vsdrunk maybe?
* close VS
* remove the hidden folder
.vs
* remove all bin
and obj
folder next to each csproj (DO NOT TOUCH THE .git
FOLDER OR WHAT'S INSIDE)
* restart vsThat didn't work either 😦
worst part is all the issues on the internet show vscode 😦
I'm updating it, apparently it had problems with copilot chat
That was it, solved, thank you a lot
Well, no, It just don't work for that specific file
there is also the code cleanup
but sure a stronger formatter in vs wouldn't hurt for me