Skip to content
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

API Request: Control over history #8096

Closed
johnfn opened this issue Jun 24, 2016 · 3 comments
Closed

API Request: Control over history #8096

johnfn opened this issue Jun 24, 2016 · 3 comments
Assignees
Labels
api feature-request Request for new features or functionality VIM VIM issue
Milestone

Comments

@johnfn
Copy link
Contributor

johnfn commented Jun 24, 2016

In the process of working on a Vim plugin for VSCode I've run into a number of areas where I need a little bit of API help. Apologies if any of my suggestions already exist!

Vim's undo/redo history diverges from VSCode's almost immediately, since multiple changes in Vim can be considered a single undo step. This is very important just about everywhere in Vim, and is especially important in things like macros which combine multiple actions into a single step.

@jrieken jrieken removed their assignment Jun 24, 2016
@alexdima
Copy link
Member

alexdima commented Jun 28, 2016

The edits coming in from the extension host (i.e. textEditor.edit) eventually reach https://github.com/Microsoft/vscode/blob/master/src/vs/editor/common/commonCodeEditor.ts#L599

It pushes an undo stop before and after the edit.

It was not always like that. I changed it due to feedback from extension writers - #4313

I have a feeling that neither way makes everyone happy (i.e. some prefer to have undo stops before and after their edits, and some prefer not to), and we need additional options to textEditor.edit

That being said, you could try to workaround it. From your example about macros, why not make all the edits caused by a macro in a single textEditor.edit call...

@johnfn
Copy link
Contributor Author

johnfn commented Jun 30, 2016

@alexandrudima

That being said, you could try to workaround it. From your example about macros, why not make all the edits caused by a macro in a single textEditor.edit call...

If I understand right, that's not possible, because a macro could insert and delete in overlapping regions, which is something the TextEditorEdit doesn't support.

@alexdima
Copy link
Member

alexdima commented Jul 8, 2016

Indeed, the TextEditor.edit can handle multiple edits, but their semantic is that they are "parallel" (all applied at once), not "sequential" (applied in strict order with side-effects to the ones following).

@alexdima alexdima added feature-request Request for new features or functionality VIM VIM issue labels Jul 8, 2016
@alexdima alexdima added this to the Backlog milestone Jul 8, 2016
@johnfn johnfn mentioned this issue Jul 9, 2016
89 tasks
@egamma egamma mentioned this issue Jul 9, 2016
4 tasks
@alexdima alexdima modified the milestones: August 2016, Backlog Aug 16, 2016
@vscodebot vscodebot bot locked and limited conversation to collaborators Nov 18, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
api feature-request Request for new features or functionality VIM VIM issue
Projects
None yet
Development

No branches or pull requests

4 participants