mirror of
https://github.com/pulsar-edit/pulsar.git
synced 2024-11-13 08:44:12 +03:00
Support includes inside of injection grammars
This commit is contained in:
parent
efdb750334
commit
71c86381df
@ -615,6 +615,23 @@ describe "TextMateGrammar", ->
|
||||
expect(tokens[1].scopes).toEqual ["source.java", "comment.line.double-slash.java"]
|
||||
expect(tokens[1].value).toEqual 'comment'
|
||||
|
||||
describe "HTML (Ruby - ERB)", ->
|
||||
beforeEach ->
|
||||
atom.activatePackage('html-tmbundle', sync: true)
|
||||
atom.activatePackage('ruby-tmbundle', sync: true)
|
||||
grammar = syntax.selectGrammar('page.erb')
|
||||
lines = grammar.tokenizeLines '<% page_title "My Page" %>'
|
||||
|
||||
it "correctly parses strings inside tags", ->
|
||||
tokens = lines[0]
|
||||
|
||||
expect(tokens[2].value).toEqual '"'
|
||||
expect(tokens[2].scopes).toEqual ["text.html.erb", "meta.embedded.line.erb", "string.quoted.double.ruby", "punctuation.definition.string.begin.ruby"]
|
||||
expect(tokens[3].value).toEqual 'My Page'
|
||||
expect(tokens[3].scopes).toEqual ["text.html.erb", "meta.embedded.line.erb", "string.quoted.double.ruby"]
|
||||
expect(tokens[4].value).toEqual '"'
|
||||
expect(tokens[4].scopes).toEqual ["text.html.erb", "meta.embedded.line.erb", "string.quoted.double.ruby", "punctuation.definition.string.end.ruby"]
|
||||
|
||||
describe "Surrogate pair characters", ->
|
||||
beforeEach ->
|
||||
atom.activatePackage('javascript-tmbundle', sync: true)
|
||||
|
@ -193,7 +193,7 @@ class Injections
|
||||
for regex in values.patterns
|
||||
pattern = new Pattern(grammar, regex)
|
||||
anchored = true if pattern.anchored
|
||||
patterns.push(pattern)
|
||||
patterns.push(pattern.getIncludedPatterns(grammar, patterns)...)
|
||||
@injections.push
|
||||
anchored: anchored
|
||||
selector: new TextMateScopeSelector(selector)
|
||||
|
Loading…
Reference in New Issue
Block a user