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

breaks use of snippet placeholders #3005

Closed
mvolkmann opened this issue Aug 29, 2018 · 1 comment · Fixed by #4570
Closed

breaks use of snippet placeholders #3005

mvolkmann opened this issue Aug 29, 2018 · 1 comment · Fixed by #4570

Comments

@mvolkmann
Copy link

When entering the variable parts of a snippet, the placeholder for the current part should be automatically replaced by whatever is typed. This works when the Vim extension is disabled. When it is enabled, the entered text just goes after the placeholder and the placeholder remains. The end result is that you really can't use snippet placeholders when the Vim extension is enabled.

This only seems to happen when the placeholder variable is referred to again on another line. For example,

  "test": {
    "prefix": "test",
    "body": ["line 1 ${1:my-placeholder}", "placeholder = ${1}"]
  },
@ghost
Copy link

ghost commented Sep 28, 2018

Just a wild guess but it might be related to #843?

J-Fields pushed a commit that referenced this issue Mar 27, 2020

Unverified

This user has not yet uploaded their public signing key.
Fixes multicursor snippets, and adds support for stuff like auto-bracketing and auto-completion on multicursor mode.

Backspace Support:
Makes range represent the selection at position. This way we delete the correct range rather than the primary selection as it was before these changes.

Multicursor Character Insert:
Makes multicursor text insertion behave like single cursor text insertion by ultimately using the default: type command rather than vscode.TextEditor.insert() which doesn't have support for snippet mode, auto completion, bracketing, etc.

To accomplish this, I've added an optional property (isMultiCursor) to InsertTextVSCodeTransformation which represents vimState.isMultiCursorat the time the transformation was created. This property is used to filter the multicursor transformations into multicursorTextTransformations.

Because the default: type command handles inserting the text into the correct cursor positions there's no need to repeat the transformation multiple times and we can just execute the command once, as long as we know all transformations are trying to do the same thing.

Fixes #4281, fixes #4223, fixes #3005, fixes #4522, fixes #4515, fixes #1946, fixes #3976
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant