Skip to content

Commit 8283140

Browse files
feat: JS/ERB language support (#188)
Introduces configuration, highlighting, and injection files for JS/ERB templates. --------- Co-authored-by: Marco Roth <[email protected]>
1 parent 68e0cab commit 8283140

File tree

4 files changed

+28
-1
lines changed

4 files changed

+28
-1
lines changed

extension.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,14 @@ languages = ["Ruby"]
1313

1414
[language_servers.ruby-lsp]
1515
name = "Ruby LSP"
16-
languages = ["Ruby", "ERB", "HTML/ERB", "YAML/ERB"]
16+
languages = ["Ruby", "ERB", "HTML/ERB", "YAML/ERB", "JS/ERB"]
1717

1818
[language_servers.ruby-lsp.language_ids]
1919
"Ruby" = "ruby"
2020
"ERB" = "erb"
2121
"HTML/ERB" = "erb"
2222
"YAML/ERB" = "erb"
23+
"JS/ERB" = "erb"
2324

2425
[language_servers.rubocop]
2526
name = "Rubocop"

languages/js-erb/config.toml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
name = "JS+ERB"
2+
grammar = "embedded_template"
3+
path_suffixes = ["js.erb"]
4+
autoclose_before = ">})"
5+
brackets = [{ start = "<", end = ">", close = true, newline = true }]
6+
block_comment = ["<%#", "%>"]
7+
word_characters = ["?", "!"]

languages/js-erb/highlights.scm

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
(comment_directive) @comment
2+
3+
[
4+
"<%#"
5+
"<%"
6+
"<%="
7+
"<%_"
8+
"<%-"
9+
"%>"
10+
"-%>"
11+
"_%>"
12+
] @keyword

languages/js-erb/injections.scm

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
((code) @content
2+
(#set! "language" "ruby")
3+
(#set! "combined"))
4+
5+
((content) @content
6+
(#set! "language" "javascript")
7+
(#set! "combined"))

0 commit comments

Comments
 (0)