Skip to content
This repository has been archived by the owner on Dec 15, 2022. It is now read-only.

Expansion of nested snippets #192

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open

Expansion of nested snippets #192

wants to merge 6 commits into from

Conversation

314eter
Copy link

@314eter 314eter commented Feb 11, 2016

Fixes #152.
snippets

shift-tab on first tab-stop should destroy the expansion, and
if possible move to the previous tab-stop of a  surrounding expansion
@314eter 314eter changed the title Expansion of nested snippets. Fixes #152. Expansion of nested snippets Feb 11, 2016
@@ -655,6 +651,43 @@ describe "Snippets extension", ->
expect(editor.lineTextForBufferRow(7)).toBe " }one t1 three"
expect(editor.lineTextForBufferRow(12)).toBe "};one t1 three"

describe "when there are nested snippets", ->
it "tries to expand before moving to the next tabstop", ->
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test fails. The keybindings are resolved in the wrong order, but only in tests, it works in real life. This is the reason that the next test fails too.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm confused about the current intended behaviour when a snippet is triggered within an existing expansion. According to the specs, it should go to the next tabstop without expanding, but according to the keymaps (snippets-1.cson and snippets-2.cson), it should try to expand first. When I try it myself, it expands most of the times, but not always.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it would make sense to attempt to expand first if possible.

Works with multiple cursors and multi-snippets now.
@PierBover
Copy link
Contributor

At last!

When will this branch be merged?

@stanfieldr
Copy link

Any plans to move forward with this?

@edzkite
Copy link

edzkite commented Aug 27, 2019

Hi, are there any plans to implement these changes? Happy to revive this effort if the behavior in question is desired.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Snippets do not behave as expected when expanding within another snippet
5 participants