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

Snippet placeholder bug #15

Closed
zlangley opened this issue Mar 2, 2014 · 4 comments · Fixed by #312
Closed

Snippet placeholder bug #15

zlangley opened this issue Mar 2, 2014 · 4 comments · Fixed by #312
Labels

Comments

@zlangley
Copy link

zlangley commented Mar 2, 2014

I'm trying to write a snippet for def in Scala:

'method':
  'prefix': 'def'
  'body': 'def ${1:method}${2:(${3:arg}: ${4:Type})} = {\n\t$0\n}'

After typing in the method name and hitting tab, the parentheses and arguments should be highlighted, but Atom highlights the most of the method name I typed too (everything but the first character).

@zlangley
Copy link
Author

zlangley commented Mar 2, 2014

Hmm... tried writing a test to confirm this bug, but the test passed. Any idea what's going on? When I use this snippet in practice, the selected buffer range after typing foo and hitting tab is [[0, 5], [0, 18]].

Here is the diff for the test I wrote: https://gist.github.com/zlangley/9301362

@kevinsawicki
Copy link
Contributor

I think this could be a bug in the markers API provided by atom/text-buffer.

The text is bleeding over from one tab stop to another since there is no text in between them.

@vigo
Copy link

vigo commented Apr 15, 2014

When I press tab to jump next placeholder, it looses cursor position. Next place holder starts from very early, like;

<h1>${1:Text}${2:<small>$3</small>}</h1>$0

First match is ok, type something, then press tab then boom :)

@robballou
Copy link

Is there an issue already in https://github.com/atom/text-buffer for this? I know this affects atom/language-php#27 and likely other snippets. Thanks!

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