mirror of
https://github.com/atom/atom.git
synced 2026-02-18 10:31:54 -05:00
Snippets parser can parse tab stops in the form of $1, $2, etc.
It associates each tab stop with its position relative to the beginning of the snippet body, and strips the '$number' marker from the inserted snippet body.
This commit is contained in:
@@ -85,3 +85,19 @@ describe "Snippets extension", ->
|
||||
expect(snippet.prefix).toBe 't2'
|
||||
expect(snippet.description).toBe "Test snippet 2"
|
||||
expect(snippet.body).toBe "this is a test 2"
|
||||
|
||||
it "can parse snippets with tabstops", ->
|
||||
snippets = Snippets.snippetsParser.parse """
|
||||
# this line intentially left blank.
|
||||
snippet t1 "Test snippet 1"
|
||||
then go back to here: ($2)
|
||||
first go here: ($1)
|
||||
endsnippet
|
||||
"""
|
||||
|
||||
snippet = snippets['t1']
|
||||
expect(snippet.body).toBe """
|
||||
then go back to here: ()
|
||||
first go here: ()
|
||||
"""
|
||||
expect(snippet.tabStops).toEqual [[1, 16], [0, 23]]
|
||||
|
||||
Reference in New Issue
Block a user