You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I haven't succeeded in creating a complete reproduction of this issue. What happened is this: as I was editing a source file, I noticed that every time I saved, an additional semi-colon was added after a function. At some point it would create one new semicolon after each save, stacking them up and generating syntax error. Currently, it just switches between adding an extra semi-colon, and then removing it on next save.
This only appears on a particular function. I have Prettier as formatter, but this error doesn't happen if I run Prettier separately from the command pallette, only when saving. I checked the Format on Save settings and the error only appears if set to modifications or modificationsIfAvailable, not on full. So this tells me the error happens because some interplay between the change in this file vs what's in Git. Maybe the diff that extracts only the modified lines plays poorly with the Prettier formatter?
If I copy the same code to another file, the issue doesn't appear, which makes sense as there is not Git history for it to use. I can send the full before and after source if needed but I would prefer to keep it private. See below for a screencap in diff mode when I save several times, it adds and then removes and then adds semicolon.
Screen.Recording.2022-04-06.at.13.49.36.mov
VS Code version: Code 1.66.0 (e18005f, 2022-03-30T05:50:04.419Z)
OS version: Darwin x64 18.7.0
Restricted Mode: No
System Info
Item
Value
CPUs
Intel(R) Core(TM) i7-3720QM CPU @ 2.60GHz (8 x 2600)
It looks like the issue is caused by one of your installed extensions. All extensions execute together on a single nodejs process, so in order to narrow down the possible problematic extension, please try the following:
run F1 > Help: Start Extension Bisect
(this will restart VS Code with half of your extensions disabled)
try to do the steps which reproduce the problem
if the problem reproduces, click "This is bad" (this narrows down the problematic extension to the half which was enabled)
if the problem does not reproduce, click "Good now" (this narrows down the problematic extension to the half which was disabled)
these steps will repeat until the problematic extension is found
Thanks! I've completed the Bisect and as suspected it was Prettier, but it only happens when VS Code is set to auto-format on save by "editor.formatOnSaveMode": "modificationsIfAvailable" or "editor.formatOnSaveMode": "modifications", NOT when "editor.formatOnSaveMode": "file".
Thanks a great find. Closing this issue and asking you to raise it issue against prettier. Format on save with modificationsIfAvailable is technically the same as format selection, e.g it uses the same underlying API (DocumentRangeFormattingEditProvider), and when formatting results are wrong it's usually an issue with the extension
Issue Type: Bug
I haven't succeeded in creating a complete reproduction of this issue. What happened is this: as I was editing a source file, I noticed that every time I saved, an additional semi-colon was added after a function. At some point it would create one new semicolon after each save, stacking them up and generating syntax error. Currently, it just switches between adding an extra semi-colon, and then removing it on next save.
This only appears on a particular function. I have Prettier as formatter, but this error doesn't happen if I run Prettier separately from the command pallette, only when saving. I checked the Format on Save settings and the error only appears if set to modifications or modificationsIfAvailable, not on full. So this tells me the error happens because some interplay between the change in this file vs what's in Git. Maybe the diff that extracts only the modified lines plays poorly with the Prettier formatter?
If I copy the same code to another file, the issue doesn't appear, which makes sense as there is not Git history for it to use. I can send the full before and after source if needed but I would prefer to keep it private. See below for a screencap in diff mode when I save several times, it adds and then removes and then adds semicolon.
Screen.Recording.2022-04-06.at.13.49.36.mov
VS Code version: Code 1.66.0 (e18005f, 2022-03-30T05:50:04.419Z)
OS version: Darwin x64 18.7.0
Restricted Mode: No
System Info
canvas_oop_rasterization: disabled_off
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
metal: disabled_off
multiple_raster_threads: enabled_on
oop_rasterization: enabled
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
skia_renderer: enabled_on
video_decode: enabled
video_encode: enabled
webgl: enabled
webgl2: enabled
Extensions (39)
(2 theme extensions excluded)
A/B Experiments
The text was updated successfully, but these errors were encountered: