Closed mattmc3 closed 2 years ago
Someone ran into a similar issue & solved it: https://github.com/bmalehorn/vscode-fish/issues/21#issuecomment-925500683
Could you try their solution @mattmc3?
I tried, but I don't have Prettier installed. I did a full uninstall (including removal of "$HOME/Library/Application Support/Code", removing all non-Microsoft extensions, and rebuilding my setting.json from scratch), but still no luck. If "editor.formatOnPaste": true
, a newline gets inserted on paste, but only in fish files with your extension enabled.
@mattmc3 I looked into this issue & fixed it.
The problem was that when you paste:
clipboard: "foo --bar"
...vscode-fish would format your clipboard as if it was a fish file all on its own. This would add a newline since all scripts should end with a newline:
clipboard: "foo --bar\n"
Instead, I changed it paste in your clipboard contents and then format the entire file.
So when vscode-fish is told to only format a range, it disregards this information and formats the whole file. This seems kind of wrong but it gives the best results for this use case, and fish_indent
doesn't even have a way to format a range in the first place.
Let me know if it works as expected for you.
If you have the following VSCode setting, whenever you copy and paste something, an unwanted newline is added to whatever you copied and appears on paste:
I'm unclear if this plugin is responsible, but I suspect that it's a product of this plugin using
fish_indent
to format. I'm onfish, version 3.3.1
. The workaround I'm using for now is to disable format on paste for fish only via the following settings.json snippet: