Skip to content

API Request: Control over history #8096

Closed

Description

@johnfn

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.

Activity

  1. alexdima commented on Jun 28, 2016

    @alexdima
    Member

    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...

  2. johnfn commented on Jun 30, 2016

    @johnfn
    ContributorAuthor

    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.

  3. alexdima commented on Jul 8, 2016

    @alexdima
    Member

    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).

  4. added
    feature-request
    VIM
    on Jul 8, 2016
  5. locked and limited conversation to collaborators on Nov 18, 2017
  6. added a commit that references this issue on Sep 6, 2026
    4f24ea8
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

VIMapifeature-request

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions