editorconfig / editorconfig-vscode

EditorConfig extension for Visual Studio Code
http://editorconfig.org/
MIT License
1.23k stars 117 forks source link

Feature request: Disable automatic cursor transfer when adding the last line. #361

Open Vmelnikoff opened 8 months ago

Vmelnikoff commented 8 months ago

Visual Studio Code v.1.85 + EditorConfig extension.

Settings - "files.autoSave": "afterDelay",

Current behavior (with autosave setting): After a second starts autosaving and a new last empty line is added at the beginning of typing, the cursor is moved, in the next string because of this, text break glitches, for example:

.red
{/* here - moved cursor from the VS extension EditorConfig */}
/* here - empty new line created by the VS extension EditorConfig */

In EditorConfig plugin (WebStorm) another, more correct behavior: After a second starts autosaving and a new last empty line is added, but , the cursor is NOT moved. Therefore, there are no glitches with line breaks.

.red {/* here - NOT moved cursor from the VS extension EditorConfig */}
/* here - empty new line created by the WS plugin EditorConfig */

Could you do the same behavior as WebStorm plugin (the cursor is NOT moved when auto-creating a new last empty line) in the plugin EditorConfig for VSCode?

Thank you in advance.

SunsetTechuila commented 4 months ago

I don't think that can be fixed on the extension side

this is where the cursor goes when setting selection to Position(46, 0)

image

and this is when setting selection to Position(46, 1)

image

no way to place it between the brace and the newline

SunsetTechuila commented 4 months ago

it seems that vscode does the same what this extension does so there is might be an issue with the public api

SunsetTechuila commented 4 months ago

p.s.

copying the value ([...activeEditor.selections]) instead of the reference here doesn't fix anything