Skip to content

Commit

Permalink
Merge pull request #50 from hugopl/highlight-update
Browse files Browse the repository at this point in the history
Highlight update
  • Loading branch information
nobodywasishere authored Dec 18, 2024
2 parents fb5e34f + d4a5296 commit 734ecdd
Show file tree
Hide file tree
Showing 4 changed files with 58 additions and 21 deletions.
7 changes: 7 additions & 0 deletions queries/injections.scm
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
((comment) @injection.content
(#set! injection.language "comment"))

(heredoc_body
(heredoc_content) @injection.content
(heredoc_end) @injection.language
(#downcase! @injection.language))
21 changes: 21 additions & 0 deletions queries/nvim/folds.scm
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
[
(annotation_def)
(begin_block)
(block)
(c_struct_def)
(case)
(class_def)
(else)
(enum_def)
(fun_def)
(if)
(lib_def)
(method_def)
(module_def)
(rescue_block)
(select)
(struct_def)
(union_def)
(when)
(while)
] @fold
44 changes: 23 additions & 21 deletions queries/highlights.scm → queries/nvim/highlights.scm
Original file line number Diff line number Diff line change
@@ -1,31 +1,29 @@
(identifier) @variable

((constant) @constant
(#match? @constant "^[A-Z\\d_]+$"))

[
"alias"
"annotation"
"begin"
"break"
"case"
"class"
"def"
"do"
"end"
"ensure"
"extend"
"in"
"module"
"include"
"lib"
"next"
"rescue"
"select"
"then"
"unless"
"until"
"when"
"while"
] @keyword
["def" "fun"] @keyword.function
["class" "enum" "module" "struct" "type" "union"] @keyword.type
["require"] @keyword.import
["return" "yield"] @keyword.return
["if" "else" "elsif"] @keyword.conditional
["if" "else" "elsif" "unless"] @keyword.conditional
["while" "until"] @keyword.repeat
["rescue"] @keyword.exception
[(private) (protected) "abstract"] @keyword.modifier

(pseudo_constant) @constant.builtin

Expand All @@ -36,9 +34,13 @@

(regex) @string.regex

(heredoc_content) @string
[(heredoc_start) (heredoc_end)] @label

(string_escape_sequence) @escape

[(integer) (float)] @number
(integer) @number
(float) @number.float

[(true) (false)] @boolean

Expand Down Expand Up @@ -73,13 +75,10 @@
"}"
] @punctuation.bracket

(class_def name: [(constant) (generic_type)] @type)
; Types
[(constant) (generic_instance_type) (generic_type)] @type

(module_def name: [(constant) (generic_type)] @module)

(struct_def name: [(constant) (generic_type)] @type)

(enum_def name: [(constant)] @type)
(annotation (constant) @attribute)

(method_def name: [(identifier) (constant)] @function.method)

Expand All @@ -88,4 +87,7 @@
[
(class_var)
(instance_var)
] @property
] @variable.member

; function calls
(call method: (identifier) @function.call)
7 changes: 7 additions & 0 deletions queries/nvim/injections.scm
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
((comment) @injection.content
(#set! injection.language "comment"))

(heredoc_body
(heredoc_content) @injection.content
(heredoc_end) @injection.language
(#downcase! @injection.language))

0 comments on commit 734ecdd

Please sign in to comment.