dotnet / format

Home for the dotnet-format command
MIT License
1.94k stars 172 forks source link

Support formatting .cshtml and .razor files #153

Open mort3za opened 5 years ago

mort3za commented 5 years ago

I just tried
dotnet-format --files Home/Home.cshtml on my razor template but seems it does not read it at all.
(But tried on other filetypes and works great).
Is razor templates supported?

JoeRobich commented 5 years ago

@mort3za Sorry but dotnet-format does not currently work with razor files. We would like to support razor scenarios in the future.

DefinitelyADev commented 4 years ago

Is this still a thing? Are there any alternative linters/formatters for razor or cshtml syntax?

NTaylorMullen commented 4 years ago

/cc @ajaybhargavb for curiosities sake. It'd be a suppper hard problem to do right if we're taking into account things like TagHelpers/Components 😄

xt0rted commented 4 years ago

Is there even editorconfig support for razor files (outside of the basic spacing, encoding, and line endings)? Yesterday I was trying to set them up to use K&R style braces while my .cs files used Allman but the format feature in VS wasn't formatting the razor files with the new expected brace style. It seems like whatever you pick for your c# settings gets used for all c# code instead of letting you have settings based on the file extension.

jordan-cote commented 3 years ago

Still looking for a CLI solution to format .cs, .cshtml and .razor files.

seriouz commented 3 years ago

can't dotnet format just format the content from the @code { } block from razor files?

somegenericdev commented 9 months ago

Any updates on this?