aboutsummaryrefslogtreecommitdiff
path: root/runtime
diff options
context:
space:
mode:
Diffstat (limited to 'runtime')
-rw-r--r--runtime/doc/eval.txt3
-rw-r--r--runtime/doc/options.txt5
-rw-r--r--runtime/doc/quickref.txt1
-rw-r--r--runtime/doc/treesitter.txt42
-rw-r--r--runtime/doc/vim_diff.txt1
-rw-r--r--runtime/lua/vim/treesitter/query.lua7
6 files changed, 44 insertions, 15 deletions
diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt
index 8c360b1778..e32691dfb4 100644
--- a/runtime/doc/eval.txt
+++ b/runtime/doc/eval.txt
@@ -6358,8 +6358,7 @@ mode([expr]) Return a string that indicates the current mode.
Rv Virtual Replace |gR|
Rx Replace mode |i_CTRL-X| completion
c Command-line editing
- cv Vim Ex mode |gQ|
- ce Normal Ex mode |Q|
+ cv Vim Ex mode |Q| or |gQ|
r Hit-enter prompt
rm The -- more -- prompt
r? |:confirm| query of some sort
diff --git a/runtime/doc/options.txt b/runtime/doc/options.txt
index 6aa508956b..ab2230641d 100644
--- a/runtime/doc/options.txt
+++ b/runtime/doc/options.txt
@@ -4539,11 +4539,6 @@ A jump table for the options with a short description can be found at |Q_op|.
List of items that control the format of the output of |:hardcopy|.
See |popt-option|.
- *'prompt'* *'noprompt'*
-'prompt' boolean (default on)
- global
- When on a ":" prompt is used in Ex mode.
-
*'pumblend'* *'pb'*
'pumblend' 'pb' number (default 0)
global
diff --git a/runtime/doc/quickref.txt b/runtime/doc/quickref.txt
index fb20a583c9..c19b05f6c7 100644
--- a/runtime/doc/quickref.txt
+++ b/runtime/doc/quickref.txt
@@ -809,7 +809,6 @@ Short explanation of each option: *option-list*
'printmbcharset' 'pmbcs' CJK character set to be used for :hardcopy
'printmbfont' 'pmbfn' font names to be used for CJK output of :hardcopy
'printoptions' 'popt' controls the format of :hardcopy output
-'prompt' 'prompt' enable prompt in Ex mode
'pumheight' 'ph' maximum height of the popup menu
'pumwidth' 'pw' minimum width of the popup menu
'pythondll' name of the Python 2 dynamic library
diff --git a/runtime/doc/treesitter.txt b/runtime/doc/treesitter.txt
index 340db92ae3..5ddc0394cd 100644
--- a/runtime/doc/treesitter.txt
+++ b/runtime/doc/treesitter.txt
@@ -226,6 +226,18 @@ Here is a list of built-in predicates :
Each predicate has a `not-` prefixed predicate that is just the negation of
the predicate.
+ *vim.treesitter.query.add_predicate()*
+vim.treesitter.query.add_predicate({name}, {handler})
+
+This adds a predicate with the name {name} to be used in queries.
+{handler} should be a function whose signature will be : >
+ handler(match, pattern, bufnr, predicate)
+<
+ *vim.treesitter.query.list_predicates()*
+vim.treesitter.query.list_predicates()
+
+This lists the currently available predicates to use in queries.
+
Treesitter Query Directive *lua-treesitter-directives*
Treesitter queries can also contain `directives`. Directives store metadata for a node
@@ -249,6 +261,21 @@ Here is a list of built-in directives:
`({capture_id}, {start_row}, {start_col}, {end_row}, {end_col}, {key?})`
The default key is "offset".
+ *vim.treesitter.query.add_directive()*
+vim.treesitter.query.add_directive({name}, {handler})
+
+This adds a directive with the name {name} to be used in queries.
+{handler} should be a function whose signature will be : >
+ handler(match, pattern, bufnr, predicate, metadata)
+Handlers can set match level data by setting directly on the metadata object `metadata.key = value`
+Handlers can set node level data by using the capture id on the metadata table
+`metadata[capture_id].key = value`
+
+ *vim.treesitter.query.list_directives()*
+vim.treesitter.query.list_directives()
+
+This lists the currently available directives to use in queries.
+
Treesitter syntax highlighting (WIP) *lua-treesitter-highlight*
NOTE: This is a partially implemented feature, and not usable as a default
@@ -406,8 +433,13 @@ get_query_files({lang}, {query_name}, {is_included})
{is_included} Internal parameter, most of the time left
as `nil`
+list_directives() *list_directives()*
+ Return: ~
+ The list of supported directives.
+
list_predicates() *list_predicates()*
- TODO: Documentation
+ Return: ~
+ The list of supported predicates.
parse_query({lang}, {query}) *parse_query()*
Parse {query} as a string. (If the query is in a file, the
@@ -487,11 +519,9 @@ Query:iter_matches({self}, {node}, {source}, {start}, {stop})
for id, node in pairs(match) do
local name = query.captures[id]
-- `node` was captured by the `name` capture in the match
-<
->
- local node_data = metadata[id] -- Node level metadata
-<
->
+
+ local node_data = metadata[id] -- Node level metadata
+
... use the info here ...
end
end
diff --git a/runtime/doc/vim_diff.txt b/runtime/doc/vim_diff.txt
index 27c4b82aca..a259afded0 100644
--- a/runtime/doc/vim_diff.txt
+++ b/runtime/doc/vim_diff.txt
@@ -473,6 +473,7 @@ Options:
'maxmem' Nvim delegates memory-management to the OS.
'maxmemtot' Nvim delegates memory-management to the OS.
'maxcombine' (6 is always used)
+ *'prompt'* *'noprompt'*
*'restorescreen'* *'rs'* *'norestorescreen'* *'nors'*
'shelltype'
*'shortname'* *'sn'* *'noshortname'* *'nosn'*
diff --git a/runtime/lua/vim/treesitter/query.lua b/runtime/lua/vim/treesitter/query.lua
index b81eb18945..4ecd91d295 100644
--- a/runtime/lua/vim/treesitter/query.lua
+++ b/runtime/lua/vim/treesitter/query.lua
@@ -351,7 +351,12 @@ function M.add_directive(name, handler, force)
directive_handlers[name] = handler
end
---- Returns the list of currently supported predicates
+--- @return The list of supported directives.
+function M.list_directives()
+ return vim.tbl_keys(directive_handlers)
+end
+
+--- @return The list of supported predicates.
function M.list_predicates()
return vim.tbl_keys(predicate_handlers)
end