nvim-treesitter/runtime/queries/make/highlights.scm

174 lines
2.6 KiB
Scheme
Raw Permalink Normal View History

2022-09-26 10:19:02 +01:00
(comment) @comment @spell
2021-12-14 10:47:47 +00:00
(conditional
2024-01-06 15:05:50 +09:00
(_
[
"ifeq"
"else"
"ifneq"
"ifdef"
"ifndef"
] @keyword.conditional)
"endif" @keyword.conditional)
2021-12-14 10:47:47 +00:00
2024-01-06 15:05:50 +09:00
(rule
(targets
(word) @function))
(rule
(targets) @_target
(prerequisites
(word) @function
(#eq? @_target ".PHONY")))
(rule
2024-01-06 15:05:50 +09:00
(targets
(word) @function.builtin
(#any-of? @function.builtin
".DEFAULT" ".SUFFIXES" ".DELETE_ON_ERROR" ".EXPORT_ALL_VARIABLES" ".IGNORE" ".INTERMEDIATE"
".LOW_RESOLUTION_TIME" ".NOTPARALLEL" ".ONESHELL" ".PHONY" ".POSIX" ".PRECIOUS" ".SECONDARY"
".SECONDEXPANSION" ".SILENT" ".SUFFIXES")))
2024-01-06 15:05:50 +09:00
(rule
[
"&:"
":"
"::"
"|"
2024-01-06 15:05:50 +09:00
] @operator)
[
"export"
"unexport"
] @keyword.import
2024-01-06 15:05:50 +09:00
(override_directive
"override" @keyword)
feat!: align standard captures with upstream Problem: Sharing highlight queries with upstream tree-sitter and Helix is difficult. Solution: Where reasonable, use capture names in tree-sitter's standard list or Helix's Atom-style hierarchy. Specifically: * tree-sitter "standard capture names" (https://github.com/tree-sitter/tree-sitter/blob/3f44b896852eb7daaa6df4fb778c9bb52c70c815/highlight/src/lib.rs#L20-L72): - `@parameter` -> `@variable.parameter` - `@field` -> `@variable.member` - `@namespace` -> `@module` - `@float` -> `@number.float` - `@symbol` -> `@string.special.symbol` - `@string.regex` -> `@string.regexp` - `@text.*` -> `@markup.*` (`strong`, `italic`, `link`, `strikethrough`; with exceptions; see below) - `@text.title` -> `@markup.heading` - `@text.literal` -> `@markup.raw` - `@text.reference` -> `@markup.link` - `@text.uri` -> `@markup.link.url` (in markup links) - `@string.special` -> `@markup.link.label` (non-url links) - `@punctuation.special` -> `@markup.list` (markdown lists only; move subitems from `@text.todo`) * Helix captures (https://docs.helix-editor.com/master/themes.html#syntax-highlighting): - `@method` -> `@function.method` - `@method.call` -> `@function.method.call` - `@text.{todo,warning,note,danger}` -> `@comment.{error,warning,hint,info,todo}` - `@text.diff.{add,delete,}` -> `@diff.{plus,minus,delta}` - `@text.uri` -> `@string.special.url` (outside markup) - `@preproc` -> `@keyword.directive` - `@define` -> `@keyword.directive`(`.define`?) - `@storageclass` -> `@keyword.storage` - `@conditional` -> `@keyword.conditional` - `@debug` -> `@keyword.debug` - `@exception` -> `@keyword.exception` - `@include` -> `@keyword.import` - `@repeat` -> `@keyword.repeat` * cleanup - remove some redundant `@conceal` (but still allow it for conceal-only patterns) - remove obsolete `@error` (syntax linting is out of scope for this repo) - sort, cleanup capture list in `CONTRIBUTING.md`
2023-12-24 10:00:20 +01:00
(include_directive
2024-01-06 15:05:50 +09:00
[
"include"
"-include"
] @keyword.import
filenames: (list
(word) @string.special.path))
2021-12-14 10:47:47 +00:00
(variable_assignment
2024-01-06 15:05:50 +09:00
name: (word) @string.special.symbol
[
"?="
":="
"::="
; ":::="
"+="
"="
] @operator)
2021-12-14 10:47:47 +00:00
(shell_assignment
2024-01-06 15:05:50 +09:00
name: (word) @string.special.symbol
"!=" @operator)
(define_directive
2024-01-06 15:05:50 +09:00
"define" @keyword
name: (word) @string.special.symbol
[
"="
":="
"::="
; ":::="
"?="
"!="
]? @operator
2024-01-06 15:05:50 +09:00
"endef" @keyword)
2021-12-14 10:47:47 +00:00
(variable_assignment
2024-01-06 15:05:50 +09:00
(word) @variable.builtin
(#any-of? @variable.builtin
".DEFAULT_GOAL" ".EXTRA_PREREQS" ".FEATURES" ".INCLUDE_DIRS" ".RECIPEPREFIX" ".SHELLFLAGS"
".VARIABLES" "MAKEARGS" "MAKEFILE_LIST" "MAKEFLAGS" "MAKE_RESTARTS" "MAKE_TERMERR"
"MAKE_TERMOUT" "SHELL"))
2021-12-14 10:47:47 +00:00
; Use string to match bash
2024-01-06 15:05:50 +09:00
(variable_reference
(word) @string) @operator
2021-12-14 10:47:47 +00:00
(shell_function
2024-01-06 15:05:50 +09:00
[
"$"
"("
")"
] @operator
"shell" @function.builtin)
(function_call
[
"$"
"("
")"
] @operator)
(substitution_reference
[
"$"
"("
")"
] @operator)
(automatic_variable
"$"
_ @character.special
(#set! priority 105))
(automatic_variable
[
"$"
"("
")"
] @operator
(#set! priority 105))
(recipe_line
"@" @character.special)
2024-01-06 15:05:50 +09:00
(function_call
[
"subst"
"patsubst"
"strip"
"findstring"
"filter"
"filter-out"
"sort"
"word"
"words"
"wordlist"
"firstword"
"lastword"
"dir"
"notdir"
"suffix"
"basename"
"addsuffix"
"addprefix"
"join"
"wildcard"
"realpath"
"abspath"
"error"
"warning"
"info"
"origin"
"flavor"
"foreach"
"if"
"or"
"and"
"call"
"eval"
"file"
"value"
2026-02-26 10:34:01 +01:00
"let"
2024-01-06 15:05:50 +09:00
] @function.builtin)
"\\" @punctuation.special