-
Notifications
You must be signed in to change notification settings - Fork 30.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Insert final newline moves cursor #79927
Comments
Sorry, I don't understand what's happening here. Do you accept a completion? How/why does the widget close? Are pressing any key? Can you reproduce without extensions? What version of VS Code is this? |
|
I did a further test, to reproduce this, the following conditions must be met simultaneously:
|
Thanks. I can reproduce now. |
Ok, full steps
The debugger state below shows what's happening. The insert final newline logic kicks in (while suggest is active) and ends up moving the cursor position (from line 42 to line 43). Because the cursor moves suggest cancels and hides the widget. |
@alexandrudima need your advice here, in the end I call: model.pushEditOperations(prevSelection, [EditOperation.insert(new Position(lineCount, model.getLineMaxColumn(lineCount)), model.getEOL())], edits => prevSelection) I think this is not just about inserting a final new line but any edit operation can potentially close suggest. Btw for me the cursor does not move, but suggest still closes. |
Maybe that's an intermediate cursor state? |
@bpasero I think because the edits are done directly on the model, the cursor of the current editor can only adjust to the edit. It would be better if the edits would be done through the current editor. i.e. |
I pushed both a fix in |
Steps to Reproduce:
Files: Insert Final Newline
totrue
.The text was updated successfully, but these errors were encountered: