Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"Visual Studio code" cursor moves to end of line automatically when taking a small pause while editing some text inside my file

Inside Visual Studio code editor(version 1.15.0) the cursor moves to end of line when taking a small pause while editing some text inside my file.Please help

like image 953
rahul rathore Avatar asked Dec 06 '22 13:12

rahul rathore


2 Answers

Recently, I had the same kind of issue and the extension caused to the problem was EditorConfig. So what I simply did is open the file:

.editorconfig

which available in the same working directory, then I change:

insert_final_newline = true

to

insert_final_newline = false

Problem solved! :)

like image 173
Pasan Jayawickrama Avatar answered Jan 04 '23 15:01

Pasan Jayawickrama


This problem is due to document formatting extension installed on VS CODE. Every time you add new lines to the file and take a pause, file is formatted which will take the cursor to end of file.

Here is the simple solution of your problem:

Go to File, then toggle Auto Save option. This will also prevent auto formatting of document. Formatting will be done on manually saving the document.

If your document is not being formatted on saving the document try this:

  1. Click File > Preference > Settings
  2. Type editor.format in Search Settings input field
  3. Change editor.formatOnSave to true or add the following line to settings file "editor.formatOnSave": true
like image 37
4 revs, 2 users 78% Avatar answered Jan 04 '23 17:01

4 revs, 2 users 78%