11

When using VS Code, anytime I File > Save As, the cursor will jump to the beginning of the file. This is undesired if I am trying to create many new files and only changing 1 small line or variable. Sublime and Atom keep the cursor in the same spot when performing a Save As. Is there anyway to keep the cursor in the same location on a Save As?

I have tried disabling all extensions and currently am not trimming trailing white space. Bookmarks do not appear to work. It would seem that VS Code treats the file after a Save As as a new file and removes all bookmarks.

starball
  • 20,030
  • 7
  • 43
  • 238
wes
  • 111
  • 3
  • 2
    VS Code closes the current file and opens the other saved-as file and brings it to focus on the editor. It gets treated like any other newly opened file with the cursor at the start. The only workaround is to [setup a navigate back key](https://stackoverflow.com/q/35424367/2745495) to reopen your previous file at its previous cursor position. – Gino Mempin Jul 27 '19 at 11:50
  • 2
    Most other text editors (atom, sublime) do not behave this way – wes Jul 29 '19 at 21:49

1 Answers1

1

An issue was posted on the VS Code GitHub repo on the same day that this quesiton was posted (just about 4 hours later!) here: File > Save As moves cursor to beginning of file #77996.

The issue was fixed by commit 222401c.

According to one of the maintainers, bpasero, this was a regression that went unnoticed for a while:

Good catch, looks like this broke a while ago.

starball
  • 20,030
  • 7
  • 43
  • 238