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
The sync manager between the underlying text document and the webview has this nice feature where when you first switch to Visual Mode, it tries not to write an "edit" with applyEdit() if it looks like the document is already canonical:
The problem is, even if your document is in canonical form, if you have the incredibly common setting of "files.insertFinalNewline": true on, then it will still try and apply an edit, making your file look "dirty" and in need of a save after switching to visual mode. This always weirds me out, especially if I'm not using git in the project yet.
I believe that the canonical output emitted by visualEditor.init() trims off a "final" newline, which is why you get that diff no matter what you do. Is there any way that we can tweak that to allow a final newline to still be treated as something that is considered canonical? I think the idea would be to always push a final newline to the canonical text if one exists in the original document text.
Screen.Recording.2024-10-22.at.2.39.21.PM.mov
The text was updated successfully, but these errors were encountered:
The sync manager between the underlying text document and the webview has this nice feature where when you first switch to Visual Mode, it tries not to write an "edit" with
applyEdit()
if it looks like the document is already canonical:quarto/apps/vscode/src/providers/editor/sync.ts
Lines 132 to 135 in cd181b4
The problem is, even if your document is in canonical form, if you have the incredibly common setting of
"files.insertFinalNewline": true
on, then it will still try and apply an edit, making your file look "dirty" and in need of a save after switching to visual mode. This always weirds me out, especially if I'm not using git in the project yet.I believe that the canonical output emitted by
visualEditor.init()
trims off a "final" newline, which is why you get that diff no matter what you do. Is there any way that we can tweak that to allow a final newline to still be treated as something that is considered canonical? I think the idea would be to always push a final newline to the canonical text if one exists in the original document text.Screen.Recording.2024-10-22.at.2.39.21.PM.mov
The text was updated successfully, but these errors were encountered: