-
Notifications
You must be signed in to change notification settings - Fork 191
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
Indent issue in Javascript function block #6870
Comments
Leaving for our next triage so that @davidwengier's expertise can be employed and enjoyed. |
Looks like there is a couple of things going on here:
It seems like if I do set Tools > Options > Text editor > Html, that is what is used for Javascript formatting, so that is a workaround for the issue you might like to try @tsu1980 |
@davidwengier Thank you for investigation. I checked my Tools > Options settings again. However, the tab size and indent size for HTML was already set to 2. I also tried setting the tab size and indent size to 2 for the following file types, but unfortunately nothing changed.
|
You might need to close and reopen the document window after changing those settings. For JavaScript/TypeScript, there is actually another layer of indirection, where Razor calls the Html formatter (part of "Web Tools" I mentioned above) and they then call the JavaScript formatter, which is another team entirely! Not sure if, on their side, they pass the formatting options through to JavaScript that we sent them, or the ones they read from Tools > Options, or something else entirely. We'll see what they say. |
Oh okay, I tried again. I had restart VS after change settings this time. Unfortunately it was same, nothing changed. |
I just opened a PR for the HTML and CSS LSPs in VS to respect the size given to us from Razor (or from VS if called directly). The issue is that VS differentiates the size of a tab from the size of an indent, so we weren't using the TabSize value passed in the LSP format request for indentation. However, even with my changes, I'm still seeing 4-space indents returned from the TypeScript formatter. |
Thanks @jimmylewis I logged https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1637829/ for TypeScript to follow suit. FYI @zkat |
Describe the bug:
When I code format(Ctrl+K, Ctrl+D) a Razor file, Javascript function block indentation is broken.
Version used:
VS2022 17.3.4
VisualStudio.17.Release/17.3.4+32901.215
Razor (ASP.NET Core) 17.0.0.2232702+e1d654e792aa2fe6646a6935bcca80ff0aff4387
To reproduce:
Expected behavior:
Actual behavior:
Indent size in a function block is 4.
Additional context:
My indentation config is bellow.
.editorconfig
Tools > Options > Text editor > Javascript/Typescript > Tab
Tab size: 2
Indent size: 2
The text was updated successfully, but these errors were encountered: