Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do you prevent VS Code from reopening file at previous scroll position

Tags:

When using VS Code I'm experiencing unexpected behaviour. When I re-open a file, the editor opens at the previous scroll position.

Example:

  • I open a long file, scroll half way down make some edits, save and close the file
  • I reopen the same file again. It will open at the same scroll position where I made the edits half way down the file.

screencast

I expected that the editor would reopen the file back at the top of the file like in other text editors.

I haven't been able to find any settings that would explain this behavior.

like image 215
chriserwin Avatar asked Jun 21 '18 18:06

chriserwin


People also ask

How do I keep my VS Code always on top?

Once you've opened Visual Studio Code, just press alt + space and the system menu will appear, then you just have to select the Always on top option.

How do you stop a running file in VS Code?

VS Code maintains a debug session while the program is running, and pressing the Stop button terminates the program.

How do I enable auto save feature in VS Code?

The easiest way to turn on Auto Save is with the File > Auto Save toggle that turns on and off save after a delay. For more control over Auto Save , open User or Workspace settings and find the associated settings: files.autoSave : Can have the values: off - to disable auto save.


1 Answers

just add the following line in the settings.json:

"workbench.editor.restoreViewState": false
like image 117
DJCONTEL Avatar answered Oct 11 '22 16:10

DJCONTEL