Vue - Comments at First Column
Can we please get proper formatting options for line/block comments with .vue filetypes? Other filetypes we can set with “Line Comment at First Column/Block Comment at First Column”, but even when trying to leverage the .editorconfig, we get no change with:ij_any_block_comment_at_first_column = true
ij_any_line_comment_at_first_column = true
Please sign in to leave a comment.
As far as I am aware, Vue templates inherit this code styling part from an HTML configuration (Settings/Preferences | Editor | Code Style | HTML | Code Generation). Could you please try to configure it and check if it helps?
That was the first thing I tried - no effect. Blew out the project cache, disabled EditorConfig, etc.
It's been this way for a while, on every project, for our entire team. If I'm missing something I'm all ears, but we have no controls for setting this on vue types like other types.
If the expectation is that we control .vue formatting via the contextual reference in other areas, it doesn't appear that HTML applies this formatting option here properly either (#PS-232.9921.55).
Thank you for your reply.
Hm, I have tried to reproduce it (by controlling HTML code style) and it seems to be, both line and block comments work fine:
Am I missing something?
So it appears as though our expected behavior is different across several of these, so possible that the error is on our expectation?
Applied your above example to HTML, VUE, and JS examples. You correctly point out that this does work when directly selecting the snippet to comment - it appears that this issue is specifically related to when the entirety of the line is selected.
All selections in the below examples include the space before the tag indentation starts; not stopping at the initial character (as per your example). EditorConfig settings disabled, cache cleared and IDE restarted:
(Apologies for the external links, limitations here restricting.)
-------------------------------------------------------------------------------------
HTML
https://i.imgur.com/KyDSe4h.gif
Both Disabled
- Line Comments (Hugs the indented content, expected)
- Block Comment (Goes to first column, unexpected)
Both Enabled
- Line Comments (Goes to first column, expected)
- Block Comment (Goes to first column, expected)
VUE
https://i.imgur.com/bds1dDk.gif
Both Disabled
- Line Comments (Hugs the indented content, expected)
- Block Comment (Goes to first column, unexpected)
Both Enabled
- Line Comments (Goes to first column, expected)
- Block Comment (Goes to first column, expected)
JS
https://i.imgur.com/HtauoZ3.gif
Both Disabled
- Line Comments (Hugs the indented content, expected)
- Block Comment (Goes to first column, unexpected)
Both Enabled
- Line Comments (Goes to first column, expected)
- Block Comment (Goes to first column, expected)
-------------------------------------------------------------------------------------
Is this expected to behave differently between Line and Block comments, regardless of the selected options applied?
Thanks for sharing the test results!
I may confirm the same behaviour. However, I have tried to play around and found out that block comments have indents with the full-line selection just like in User Guide:
(https://www.jetbrains.com/help/phpstorm/2023.2/settings-code-style-html.html#ws_html_settings_code_style_code_generation)
Here is an example, the second try here is a full-line selection with a double-click first (a bit tricky during a gif recording):
Could you please try it on your setup?