microsoft / vscode

Visual Studio Code
https://code.visualstudio.com
MIT License
164.46k stars 29.36k forks source link

Pressing enter at the end of a JSDoc comment adds an extra * #121046

Open ImRodry opened 3 years ago

ImRodry commented 3 years ago

Issue Type: Bug

If you have a 1 line JSDoc comment like /** This is a JSDoc comment */ and press enter before the closing bracket (/), VSCode will add an extra , making it look like

/** This is a JSDoc comment
 * */

instead of

/** This is a JSDoc comment 
 */

Which would be the expected behavior.

VS Code version: Code 1.55.1 (08a217c4d27a02a5bcde898fd7981bda5b49391b, 2021-04-07T15:06:02.360Z) OS version: Windows_NT x64 10.0.19042

System Info |Item|Value| |---|---| |CPUs|Intel(R) Core(TM) i7-8700 CPU @ 3.20GHz (12 x 3192)| |GPU Status|2d_canvas: enabled
gpu_compositing: enabled
multiple_raster_threads: enabled_on
oop_rasterization: enabled
opengl: enabled_on
protected_video_decode: unavailable_off
rasterization: enabled
skia_renderer: enabled_on
video_decode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled| |Load (avg)|undefined| |Memory (System)|19.89GB (9.02GB free)| |Process Argv|D:\\Users\\rodri\\Documents\\GitHub\\hypixel-translators-bot --crash-reporter-id 1aa51578-c79e-468f-b062-c24334e21918| |Screen Reader|no| |VM|0%|
Extensions (25) Extension|Author (truncated)|Version ---|---|--- vscode-crowdin|Cro|1.1.0 gitlens|eam|11.4.0 EditorConfig|Edi|0.16.4 prettier-vscode|esb|6.3.2 vscode-lombok|Gab|1.0.1 vscode-graphql|Gra|0.3.15 discord-vscode|icr|5.5.0 vscode-env|Iro|0.1.0 csharp|ms-|1.23.11 python|ms-|2021.3.680753044 jupyter|ms-|2021.5.702919634 vsliveshare|ms-|1.0.4116 vsliveshare-audio|ms-|0.1.91 vsliveshare-pack|ms-|0.4.0 gradle-language|nac|0.2.3 vetur|oct|0.33.1 java|red|0.76.0 vscode-yaml|red|0.17.0 vscodeintellicode|Vis|1.2.12 vscode-java-debug|vsc|0.32.1 vscode-java-dependency|vsc|0.18.2 vscode-java-pack|vsc|0.13.0 vscode-java-test|vsc|0.28.1 vscode-maven|vsc|0.28.0 minecraft-lang-colorizer|zz5|1.0.0
A/B Experiments ``` vsliv368cf:30146710 vsreu685:30147344 python383cf:30185419 vspyt653:30270858 vspor879:30202332 vspor708:30202333 vspor363:30204092 vstry244:30276681 pythonvsdeb440:30248342 pythonvsded773:30248341 pythonvspyt875:30259475 pythonvspyt639:30281910 pythontb:30283811 wslfolderdoc:30282074 vspre833cf:30267465 pythonptprofiler:30281270 vshan820cf:30276953 pythondataviewer:30285071 vscus158cf:30286554 ```
vscodebot[bot] commented 3 years ago

(Experimental duplicate detection) Thanks for submitting this issue. Please also check if it is already covered by an existing one, like:

ImRodry commented 3 years ago

This issue is not a duplicate of neither of those

keshav-bohr commented 3 years ago

I guess this is happening in windows only. I have ubuntu system, in that it is working fine for me.

ImRodry commented 3 years ago

Yeah on Ubuntu I get this which is still not 100% ideal, that would be that it doesn't insert the new line at all and just adds */ to the end if that makes sense image

aiday-mar commented 7 months ago

Hi @ImRodry thank you for posting this issue. The way the indentation is implemented for TypeScript/JavaScript, is that if you are inside of a JS Doc and press enter from there, it will add a new asterisk on the next line, so you can continue writing your document as follows:

https://github.com/microsoft/vscode/assets/61460952/33e24d46-571e-461c-8a8d-bd3773a331a3

I believe most users appreciate the addition of the asterisk so this request is under discussion.

You mentioned initially that on a windows system after clicking enter you get:

/** This is a JSDoc comment
 * */

You should actually be getting the following (last line could have variable indentation depending on where you pressed enter):

/** This is a JSDoc comment
 * 
 */

So there appears to be a bug. Are you still able to reproduce this issue on Windows? If yes, could you include a screen recording of the reproduced issue?

ImRodry commented 7 months ago

Hey @aiday-mar, I just tried this again and the result was indeed what you described as intended, though I would personally disagree that that's the optimal behavior. The way I see it is that, if I'm making a new line right next to the closing asterisk, I'm looking to turn the 1 line comment into a multi-line comment, not necessarily adding something after the current line. I understand, however, if you and the team thinks otherwise so I'll leave that up to your judgement

vscodenpa commented 5 months ago

Hey @aiday-mar, this issue might need further attention.

@ImRodry, you can help us out by closing this issue if the problem no longer exists, or adding more information.