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

Moving the cursor should not cancel tab stops in a snippet #32790

Closed
niekvandepas opened this issue Aug 18, 2017 · 3 comments
Closed

Moving the cursor should not cancel tab stops in a snippet #32790

niekvandepas opened this issue Aug 18, 2017 · 3 comments
Assignees
Labels
*as-designed Described behavior is as designed snippets

Comments

@niekvandepas
Copy link

  • VSCode Version: Code 1.15.1 (41abd21, 2017-08-16T18:05:38.342Z)
  • OS Version: Windows_NT ia32 10.0.15063
  • Extensions:
Extension Author (truncated) Version
solargraph cas 0.7.0
cpptools ms- 0.12.3
Ruby reb 0.14.0

Steps to Reproduce:

  1. Open a .html file.
  2. Type a and press tab. The cursor should now be between the double quotes after href.
  3. Move the cursor.
  4. Press tab again.
  5. Verify that rather than jumping to the next tab stop, pressing tab has inserted a tab whitespace character.

The same issue occurs using the following user-defined snippet rather than the emmet abbreviation:

"link": {
    "prefix": "a",
    "body": "<a href=\"$1\">$2</a>" 
},

I'm assuming that this is not intended behavior, but if it is, I feel like there should be a setting to disable it. Moving the cursor to copy-paste text into snippet tab stops is an important part of some of my workflows, and I don't think I'm alone in that (this used to work in previous versions; I am not 100% sure in which version this issue first emerged).

Reproduces without extensions: Yes

@vscodebot vscodebot bot added editor editor-core Editor basic functionality labels Aug 18, 2017
@ramya-rao-a
Copy link
Contributor

@NiekPas

In you Step 3, where are you moving the cursor to? A separate location from where you wish to copy text?

When a snippet is inserted, tabbing moves you to the next tab stop, typing adds text and the next tab takes you to the next tab stop.
The moment you move the cursor manually, I believe you are taken out of the snippet mode

cc @jrieken for more snippet related info

@ramya-rao-a ramya-rao-a added snippets and removed editor editor-core Editor basic functionality snippets labels Aug 19, 2017
@ramya-rao-a ramya-rao-a assigned jrieken and unassigned rebornix Aug 19, 2017
@ramya-rao-a ramya-rao-a changed the title Moving the cursor should not cancel emmet abbreviation tab stops Moving the cursor should not cancel tab stops in a snippet Aug 19, 2017
@niekvandepas
Copy link
Author

Usually it's a separate location that contains text I want to copy into one of the tab stops. In the example of the <a> tag, this could be a hyperlink.

@jrieken jrieken added the *as-designed Described behavior is as designed label Aug 21, 2017
@jrieken
Copy link
Member

jrieken commented Aug 21, 2017

That is the design of snippets. You can move your cursor into placeholders and tabstops but as soon as you move it somewhere else snippet insertion stops. The rational for this is to have a light snippet mode that isn't sticky and hard to get out of. Also note that snippets behave like this in Textmate and Sublime.

@jrieken jrieken closed this as completed Aug 21, 2017
@vscodebot vscodebot bot locked and limited conversation to collaborators Nov 17, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
*as-designed Described behavior is as designed snippets
Projects
None yet
Development

No branches or pull requests

4 participants