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
Not quite clear, is it a bug in VSCode or in Prettier, but I bet 90% it's in VSCode, because it's VSCode who highlights errors in the text.
There is a bug somewhere when builtin VSCode's source.organizeImports feature is used together with Prettier (and probably with any other extension which rewrites the text). People sometimes prefer to use VSCode's built-in source.organizeImports feature ON SAVE which, among other things, places all imports on the same line. And this conflicts with Prettier when it formats imports at multiple lines: if there is an error in the code, the underlining of this error shifts towards beginning of the file.
Install Prettier, turn on "editor.codeActionsOnSave": { "source.organizeImports": true } in settings.json.
Open a file with a big number of imports and an error in the file and reproduce what's shown on the video. When you hit Save, and there is an error, its underlining shifts left on every save and messes everything up.
Does this issue occur when all extensions are disabled? No
I meant not everything on one line, but each individual import statement (i.e. all symbols related to one import) on the same line. Different import statements are still on different lines while using organizeImports.
But it all doesn’t quite matter, this bug report is about error underlining shifting, not about organizeImports nor prettier. I mentioned organizeImports and prettier only to show how to reproduce the bug.
Not quite clear, is it a bug in VSCode or in Prettier, but I bet 90% it's in VSCode, because it's VSCode who highlights errors in the text.
There is a bug somewhere when builtin VSCode's source.organizeImports feature is used together with Prettier (and probably with any other extension which rewrites the text). People sometimes prefer to use VSCode's built-in source.organizeImports feature ON SAVE which, among other things, places all imports on the same line. And this conflicts with Prettier when it formats imports at multiple lines: if there is an error in the code, the underlining of this error shifts towards beginning of the file.
I recorded a video which shows the effect, pretty easy to reproduce:
https://www.dropbox.com/s/apj5znzlqy8pub6/vscode-prettier.mp4?dl=0
Steps to Reproduce:
"editor.codeActionsOnSave": { "source.organizeImports": true }
in settings.json.Does this issue occur when all extensions are disabled? No
Corresponding issue at Prettier: prettier/prettier#5995
The text was updated successfully, but these errors were encountered: