aboutsummaryrefslogtreecommitdiffstats
path: root/runtime/queries/idris
diff options
context:
space:
mode:
authorChristian Clason <c.clason@uni-graz.at>2023-06-12 09:54:30 -0600
committerChristian Clason <c.clason@uni-graz.at>2025-05-12 18:43:40 +0200
commit692b051b09935653befdb8f7ba8afdb640adf17b (patch)
tree167162b6b129ae04f68c5735078521a72917c742 /runtime/queries/idris
parentfeat(c-family): inherit injections (diff)
downloadnvim-treesitter-692b051b09935653befdb8f7ba8afdb640adf17b.tar
nvim-treesitter-692b051b09935653befdb8f7ba8afdb640adf17b.tar.gz
nvim-treesitter-692b051b09935653befdb8f7ba8afdb640adf17b.tar.bz2
nvim-treesitter-692b051b09935653befdb8f7ba8afdb640adf17b.tar.lz
nvim-treesitter-692b051b09935653befdb8f7ba8afdb640adf17b.tar.xz
nvim-treesitter-692b051b09935653befdb8f7ba8afdb640adf17b.tar.zst
nvim-treesitter-692b051b09935653befdb8f7ba8afdb640adf17b.zip
feat!: drop modules, general refactor and cleanup
Diffstat (limited to 'runtime/queries/idris')
-rw-r--r--runtime/queries/idris/folds.scm1
-rw-r--r--runtime/queries/idris/highlights.scm228
-rw-r--r--runtime/queries/idris/injections.scm2
-rw-r--r--runtime/queries/idris/locals.scm33
4 files changed, 264 insertions, 0 deletions
diff --git a/runtime/queries/idris/folds.scm b/runtime/queries/idris/folds.scm
new file mode 100644
index 000000000..2f4885165
--- /dev/null
+++ b/runtime/queries/idris/folds.scm
@@ -0,0 +1 @@
+(function) @fold
diff --git a/runtime/queries/idris/highlights.scm b/runtime/queries/idris/highlights.scm
new file mode 100644
index 000000000..d3dfa7a9f
--- /dev/null
+++ b/runtime/queries/idris/highlights.scm
@@ -0,0 +1,228 @@
+; ------------------------------------------------------------------------------
+; Literals and comments
+[
+ (integer)
+ (quantity)
+] @number
+
+(literal
+ (number)) @number.float
+
+(char) @character
+
+[
+ (string)
+ (pat_string)
+ (triple_quote_string)
+] @string
+
+(comment) @comment @spell
+
+((comment) @comment.documentation
+ (#lua-match? @comment.documentation "^|||"))
+
+(unit) @constant
+
+; more general captures are moved to the top
+; before overwritten later by more specific captures
+[
+ (loname)
+ (caname)
+] @variable
+
+; ------------------------------------------------------------------------------
+; Punctuation
+[
+ "("
+ ")"
+ "{"
+ "@{"
+ "}"
+ "["
+ "[<"
+ "]"
+] @punctuation.bracket
+
+[
+ (comma)
+ (colon)
+ (pat_op)
+ (tuple_operator)
+] @punctuation.delimiter
+
+(pat_name
+ (loname) @variable.parameter)
+
+; ------------------------------------------------------------------------------
+; Types
+(signature
+ (loname) @type)
+
+; ------------------------------------------------------------------------------
+; Keywords, operators, imports
+[
+ "if"
+ "then"
+ "else"
+ "case"
+ "of"
+] @keyword.conditional
+
+[
+ "import"
+ "module"
+ "namespace"
+ "parameters"
+] @keyword.import
+
+[
+ (operator)
+ (equal)
+ (wildcard)
+ "."
+ "|"
+ "=>"
+ "⇒"
+ "<="
+ "⇐"
+ "->"
+ "→"
+ "<-"
+ "←"
+ "\\"
+ "`"
+] @operator
+
+(qualified_loname
+ (caname) @module)
+
+(qualified_caname
+ (caname) @constructor)
+
+(qualified_operator
+ (caname) @module)
+
+(import
+ (caname) @module)
+
+(module
+ (caname) @module)
+
+[
+ "let"
+ "in"
+] @keyword
+
+[
+ (where)
+ "rewrite"
+ "interface"
+ "implementation"
+ "using"
+ "record"
+ "as"
+ "do"
+ (forall)
+ (fixity)
+ (impossible)
+ (with)
+ (proof)
+] @keyword.operator
+
+[
+ (visibility)
+ (totality)
+] @keyword.modifier
+
+"data" @keyword.type
+
+[
+ "="
+ "$="
+ ":="
+] @operator
+
+(hole) @label
+
+[
+ (pragma_language)
+ (pragma_default)
+ (pragma_builtin)
+ (pragma_name)
+ (pragma_ambiguity_depth)
+ (pragma_auto_implicit_depth)
+ (pragma_logging)
+ (pragma_prefix_record_projections)
+ (pragma_transform)
+ (pragma_unbound_implicits)
+ (pragma_auto_lazy)
+ (pragma_search_timeout)
+ (pragma_nf_metavar_threshold)
+ (pragma_cg)
+ (pragma_allow_overloads)
+ (pragma_deprecate)
+ (pragma_inline)
+ (pragma_noinline)
+ (pragma_tcinline)
+ (pragma_hide)
+ (pragma_unhide)
+ (pragma_unsafe)
+ (pragma_spec)
+ (pragma_foreign)
+ (pragma_foreign_impl)
+ (pragma_export)
+ (pragma_nomangle)
+ (pragma_hint)
+ (pragma_defaulthint)
+ (pragma_globalhint)
+ (pragma_extern)
+ (pragma_macro)
+ (pragma_start)
+ (pragma_rewrite)
+ (pragma_pair)
+ (pragma_integerLit)
+ (pragma_stringLit)
+ (pragma_charLit)
+ (pragma_doubleLit)
+ (pragma_TTImpLit)
+ (pragma_declsLit)
+ (pragma_nameLit)
+ (pragma_runElab)
+ (pragma_search)
+ (pragma_World)
+ (pragma_MkWorld)
+ (pragma_syntactic)
+] @label
+
+; ------------------------------------------------------------------------------
+; Functions and variables
+(exp_name
+ (loname) @function.call)
+
+(constructor
+ "constructor" @keyword.function
+ .
+ (caname) @constructor)
+
+(exp_record_access
+ field: (_) @variable.member)
+
+(signature
+ name: (loname) @function)
+
+(function
+ (lhs
+ (funvar
+ subject: [
+ (loname)
+ (caname)
+ ] @function)))
+
+(data
+ name: (data_name) @type)
+
+(interface_head
+ name: (interface_name) @type)
+
+(implementation_head
+ (interface_name) @type)
diff --git a/runtime/queries/idris/injections.scm b/runtime/queries/idris/injections.scm
new file mode 100644
index 000000000..2f0e58eb6
--- /dev/null
+++ b/runtime/queries/idris/injections.scm
@@ -0,0 +1,2 @@
+((comment) @injection.content
+ (#set! injection.language "comment"))
diff --git a/runtime/queries/idris/locals.scm b/runtime/queries/idris/locals.scm
new file mode 100644
index 000000000..c46f831f7
--- /dev/null
+++ b/runtime/queries/idris/locals.scm
@@ -0,0 +1,33 @@
+(signature
+ name: (loname)) @local.definition.var
+
+(signature
+ name: (caname)) @local.definition.type
+
+(function
+ (lhs
+ (funvar
+ subject: (loname)))) @local.definition.function
+
+(function
+ (lhs
+ (funvar
+ subject: (caname)))) @local.definition.function
+
+(type_var
+ (loname)) @local.definition.type
+
+(pat_name
+ (loname)) @local.definition.var
+
+(pat_name
+ (caname)) @local.definition.var
+
+(exp_name
+ (loname)) @local.reference
+
+(exp_name
+ (caname)) @local.reference
+
+(function
+ (rhs) @local.scope)