mirror of
				https://github.com/neovim/neovim.git
				synced 2025-11-03 17:24:29 +00:00 
			
		
		
		
	feat(treesitter): bundle query parser and queries (#22483)
skip injections for now
This commit is contained in:
		@@ -190,6 +190,9 @@ set(TREESITTER_VIM_SHA256 1b1cd39e33c8fb02fa7fe3977e844883c2a8508a7edd621f2d21e3
 | 
			
		||||
set(TREESITTER_HELP_URL https://github.com/neovim/tree-sitter-vimdoc/archive/v1.3.0.tar.gz)
 | 
			
		||||
set(TREESITTER_HELP_SHA256 f33f6d49c7d71feb2fd68ef2b2684da150f9f8e486ad9726213631d673942331)
 | 
			
		||||
 | 
			
		||||
set(TREESITTER_QUERY_URL https://github.com/nvim-treesitter/tree-sitter-query/archive/0717de07078a20a8608c98ad5f26c208949d0e15.tar.gz)
 | 
			
		||||
set(TREESITTER_QUERY_SHA256 2f2c79a59e3ff550aef849925e589d69b8a146b3af935504366cc973399d26e1)
 | 
			
		||||
 | 
			
		||||
set(TREESITTER_URL https://github.com/tree-sitter/tree-sitter/archive/c51896d32dcc11a38e41f36e3deb1a6a9c4f4b14.tar.gz)
 | 
			
		||||
set(TREESITTER_SHA256 243e07541a9dd71681984b65bffed2d4a259bef0a4ad28cff55cc1c6878b8d18)
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -20,3 +20,4 @@ BuildTSParser(c ${TREESITTER_C_URL} ${TREESITTER_C_SHA256} TreesitterParserCMake
 | 
			
		||||
BuildTSParser(lua ${TREESITTER_LUA_URL} ${TREESITTER_LUA_SHA256} TreesitterParserCMakeLists.txt)
 | 
			
		||||
BuildTSParser(vim ${TREESITTER_VIM_URL} ${TREESITTER_VIM_SHA256} TreesitterParserCMakeLists.txt)
 | 
			
		||||
BuildTSParser(help ${TREESITTER_HELP_URL} ${TREESITTER_HELP_SHA256} TreesitterParserCMakeLists.txt)
 | 
			
		||||
BuildTSParser(query ${TREESITTER_QUERY_URL} ${TREESITTER_QUERY_SHA256} TreesitterParserCMakeLists.txt)
 | 
			
		||||
 
 | 
			
		||||
@@ -11,10 +11,10 @@
 | 
			
		||||
  arguments: (arguments (string content: _ @vim)))
 | 
			
		||||
  (#any-of? @_vimcmd_identifier "vim.cmd" "vim.api.nvim_command" "vim.api.nvim_exec" "vim.api.nvim_cmd"))
 | 
			
		||||
 | 
			
		||||
; ((function_call
 | 
			
		||||
;   name: (_) @_vimcmd_identifier
 | 
			
		||||
;   arguments: (arguments (string content: _ @query) .))
 | 
			
		||||
;   (#eq? @_vimcmd_identifier "vim.treesitter.query.set_query"))
 | 
			
		||||
((function_call
 | 
			
		||||
  name: (_) @_vimcmd_identifier
 | 
			
		||||
  arguments: (arguments (string content: _ @query) .))
 | 
			
		||||
  (#eq? @_vimcmd_identifier "vim.treesitter.query.set_query"))
 | 
			
		||||
 | 
			
		||||
; ;; highlight string as query if starts with `;; query`
 | 
			
		||||
; ((string ("string_content") @query) (#lua-match? @query "^%s*;+%s?query"))
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										6
									
								
								runtime/queries/query/folds.scm
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										6
									
								
								runtime/queries/query/folds.scm
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,6 @@
 | 
			
		||||
[
 | 
			
		||||
  (named_node)
 | 
			
		||||
  (predicate)
 | 
			
		||||
  (grouping)
 | 
			
		||||
  (list)
 | 
			
		||||
] @fold
 | 
			
		||||
							
								
								
									
										34
									
								
								runtime/queries/query/highlights.scm
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										34
									
								
								runtime/queries/query/highlights.scm
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,34 @@
 | 
			
		||||
(string) @string
 | 
			
		||||
(escape_sequence) @string.escape
 | 
			
		||||
(capture (identifier) @type)
 | 
			
		||||
(anonymous_node (identifier) @string)
 | 
			
		||||
(predicate name: (identifier) @function)
 | 
			
		||||
(named_node name: (identifier) @variable)
 | 
			
		||||
(field_definition name: (identifier) @property)
 | 
			
		||||
(negated_field "!" @operator (identifier) @property)
 | 
			
		||||
(comment) @comment @spell
 | 
			
		||||
 | 
			
		||||
(quantifier) @operator
 | 
			
		||||
(predicate_type) @punctuation.special
 | 
			
		||||
 | 
			
		||||
"." @operator
 | 
			
		||||
 | 
			
		||||
[
 | 
			
		||||
  "["
 | 
			
		||||
  "]"
 | 
			
		||||
  "("
 | 
			
		||||
  ")"
 | 
			
		||||
] @punctuation.bracket
 | 
			
		||||
 | 
			
		||||
":" @punctuation.delimiter
 | 
			
		||||
["@" "#"] @punctuation.special
 | 
			
		||||
"_" @constant
 | 
			
		||||
 | 
			
		||||
((parameters (identifier) @number)
 | 
			
		||||
 (#match? @number "^[-+]?[0-9]+(.[0-9]+)?$"))
 | 
			
		||||
 | 
			
		||||
((program . (comment) @include)
 | 
			
		||||
 (#match? @include "^;\ +inherits\ *:"))
 | 
			
		||||
 | 
			
		||||
((program . (comment) @preproc)
 | 
			
		||||
 (#match? @preproc "^; +extends"))
 | 
			
		||||
@@ -24,5 +24,5 @@
 | 
			
		||||
    "patchexpr" "pex"
 | 
			
		||||
    "charconvert" "ccv"))
 | 
			
		||||
 | 
			
		||||
(comment) @comment
 | 
			
		||||
(line_continuation_comment) @comment
 | 
			
		||||
; (comment) @comment
 | 
			
		||||
; (line_continuation_comment) @comment
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user