Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

improve highlights across languages #2910

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions languages.toml
Original file line number Diff line number Diff line change
Expand Up @@ -460,7 +460,7 @@ source = { git = "https://github.com/tree-sitter/tree-sitter-ruby", rev = "dfff6
[[language]]
name = "bash"
scope = "source.bash"
injection-regex = "bash"
injection-regex = "(shell|bash|zsh|sh)"
file-types = ["sh", "bash", "zsh", ".bash_login", ".bash_logout", ".bash_profile", ".bashrc", ".profile", ".zshenv", ".zlogin", ".zlogout", ".zprofile", ".zshrc", "APKBUILD", "PKGBUILD", "eclass", "ebuild", "bazelrc"]
shebangs = ["sh", "bash", "dash"]
roots = []
Expand Down Expand Up @@ -707,7 +707,7 @@ indent = { tab-width = 2, unit = " " }

[[grammar]]
name = "tsq"
source = { git = "https://github.com/tree-sitter/tree-sitter-tsq", rev = "b665659d3238e6036e22ed0e24935e60efb39415" }
source = { git = "https://github.com/the-mikedavis/tree-sitter-tsq", rev = "ea68fc2b571ca1c8f70936855130c380f518ff35" }

[[language]]
name = "cmake"
Expand All @@ -727,7 +727,8 @@ source = { git = "https://github.com/uyha/tree-sitter-cmake", rev = "f6616f1e417
name = "make"
scope = "source.make"
file-types = ["Makefile", "makefile", "mk", "justfile", ".justfile"]
roots =[]
injection-regex = "(make|makefile|Makefile|mk|just)"
roots = []
comment-token = "#"
indent = { tab-width = 4, unit = "\t" }

Expand Down Expand Up @@ -854,7 +855,7 @@ indent = { tab-width = 2, unit = " " }

[[grammar]]
name = "markdown"
source = { git = "https://github.com/MDeiml/tree-sitter-markdown", rev = "ad8c32917a16dfbb387d1da567bf0c3fb6fffde2" }
source = { git = "https://github.com/MDeiml/tree-sitter-markdown", rev = "ab15701d8f3f68aeb74e30573b7d669a6ef2a7ed" }

[[language]]
name = "dart"
Expand Down Expand Up @@ -907,7 +908,7 @@ indent = { tab-width = 2, unit = " " }

[[grammar]]
name = "git-commit"
source = { git = "https://github.com/the-mikedavis/tree-sitter-git-commit", rev = "7ae23de633de41f8f5b802f6f05b6596df6d00c1" }
source = { git = "https://github.com/the-mikedavis/tree-sitter-git-commit", rev = "318dd72abfaa7b8044c1d1fbeabcd06deaaf038f" }

[[language]]
name = "git-diff"
Expand Down Expand Up @@ -1051,7 +1052,7 @@ language-server = { command = "erlang_ls" }

[[grammar]]
name = "erlang"
source = { git = "https://github.com/the-mikedavis/tree-sitter-erlang", rev = "c0ebc82600caaf4339f2b00691f958e9df97c065" }
source = { git = "https://github.com/the-mikedavis/tree-sitter-erlang", rev = "0e7d677d11a7379686c53c616825714ccb728059" }

[[language]]
name = "kotlin"
Expand Down
6 changes: 3 additions & 3 deletions runtime/queries/edoc/highlights.scm
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@
; could be @constant.numeric.integer but this looks similar to a capture
(arity) @operator

[":" "/"] @operator
["(" ")"] @punctuation.delimiter
["{" "}"] @function.macro
(expression [":" "/"] @operator)
(expression ["(" ")"] @punctuation.delimiter)
(macro ["{" "}"] @function.macro)

[
(quote_marker)
Expand Down
29 changes: 17 additions & 12 deletions runtime/queries/erlang/highlights.scm
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,21 @@
; module declaration
(attribute
name: (atom) @keyword
(arguments (atom) @module)
(#eq? @keyword "module"))
(arguments (atom) @namespace)
(#match? @keyword "(module|behaviou?r)"))

(attribute
name: (atom) @keyword
(arguments
.
(atom) @module)
(atom) @namespace)
(#eq? @keyword "import"))

(attribute
name: (atom) @keyword
(arguments
.
(atom) @type
[(atom) @type (macro)]
[
(tuple (atom) @variable.other.member)
(tuple
Expand All @@ -38,8 +38,8 @@
(arguments
.
[
(atom) @keyword.directive
(variable) @keyword.directive
(atom) @constant
(variable) @constant
(call
function:
[(variable) (atom)] @keyword.directive)
Expand All @@ -54,15 +54,15 @@

(attribute
name: (atom) @keyword
module: (atom) @module
(#eq? @keyword "(spec|callback)"))
module: (atom) @namespace
(#match? @keyword "(spec|callback)"))

; Functions
(function_clause name: (atom) @function)
(call module: (atom) @module)
(call module: (atom) @namespace)
(call function: (atom) @function)
(stab_clause name: (atom) @function)
(function_capture module: (atom) @module)
(function_capture module: (atom) @namespace)
(function_capture function: (atom) @function)

; Records
Expand Down Expand Up @@ -92,13 +92,18 @@

(binary_operator operator: _ @operator)
(unary_operator operator: _ @operator)
["/" ":" "#" "->"] @operator
["/" ":" "->"] @operator

(tripledot) @comment.discard

(comment) @comment

; Macros
(macro
"?"+ @constant
name: (_) @constant
!arguments)

(macro
"?"+ @keyword.directive
name: (_) @keyword.directive)
Expand All @@ -118,6 +123,6 @@

; Punctuation
["," "." "-" ";"] @punctuation.delimiter
["(" ")" "{" "}" "[" "]" "<<" ">>"] @punctuation.bracket
["(" ")" "#" "{" "}" "[" "]" "<<" ">>"] @punctuation.bracket

; (ERROR) @error
2 changes: 1 addition & 1 deletion runtime/queries/git-commit/highlights.scm
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@
(change kind: "modified" @diff.delta)
(change kind: "renamed" @diff.delta.moved)

[":" "->"] @punctuation.delimeter
[":" "->" (scissors)] @punctuation.delimeter
(comment) @comment
2 changes: 1 addition & 1 deletion runtime/queries/heex/highlights.scm
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
; HEEx components are highlighted as Elixir modules and functions
(component_name
[
(module) @module
(module) @namespace
(function) @function
"." @punctuation.delimiter
])
9 changes: 8 additions & 1 deletion runtime/queries/html/highlights.scm
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,18 @@
(erroneous_end_tag_name) @tag.error
(doctype) @constant
(attribute_name) @attribute
(attribute_value) @string
(comment) @comment

[
"\""
(attribute_value)
] @string

[
"<"
">"
"</"
"/>"
] @punctuation.bracket

"=" @punctuation.delimiter
11 changes: 8 additions & 3 deletions runtime/queries/markdown/highlights.scm
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,9 @@
(atx_heading (atx_h5_marker) @markup.heading.marker (heading_content) @markup.heading.5)
(atx_heading (atx_h6_marker) @markup.heading.marker (heading_content) @markup.heading.6)

(code_fence_content) @none

[
(indented_code_block)
(fenced_code_block)
(code_fence_content)
] @markup.raw.block

(block_quote) @markup.quote
Expand All @@ -26,6 +24,8 @@
(link_destination) @markup.link.url
(link_label) @markup.link.label

(info_string) @label

[
(link_text)
(image_description)
Expand All @@ -47,3 +47,8 @@
(hard_line_break)
] @constant.character.escape

(thematic_break) @punctuation.delimiter

(inline_link ["[" "]" "(" ")"] @punctuation.bracket)
(image ["[" "]" "(" ")"] @punctuation.bracket)
(fenced_code_block_delimiter) @punctuation.bracket
6 changes: 3 additions & 3 deletions runtime/queries/rust/highlights.scm
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@
"::"
"."
";"
","
] @punctuation.delimiter

[
Expand Down Expand Up @@ -95,8 +96,6 @@
value: (identifier)? @variable
field: (field_identifier) @variable.other.member))

(arguments
(identifier) @variable.parameter)
(parameter
pattern: (identifier) @variable.parameter)
(closure_parameters
Expand Down Expand Up @@ -141,7 +140,6 @@
"mod"
"extern"

"fn"
"struct"
"enum"
"impl"
Expand All @@ -160,6 +158,8 @@
"async"
] @keyword

"fn" @keyword.function

(mutable_specifier) @keyword.storage.modifier.mut

(reference_type "&" @keyword.storage.modifier.ref)
Expand Down