mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-01 19:17:02 -04:00
Rename cond to condition
This commit is contained in:
parent
be1c93f848
commit
76673d61c3
2 changed files with 6 additions and 5 deletions
|
|
@ -74,12 +74,13 @@ Each module corresponds to an entry in the dictionary passed to the
|
||||||
EOF
|
EOF
|
||||||
<
|
<
|
||||||
|
|
||||||
All modules share some common options, like `enable`, `disable`, and `cond`.
|
All modules share some common options, like `enable`, `disable`, and
|
||||||
|
`condition`.
|
||||||
When `enable` is `true` this will enable the module for all supported languages,
|
When `enable` is `true` this will enable the module for all supported languages,
|
||||||
if you want to disable the module for some languages you can pass a list to the `disable` option.
|
if you want to disable the module for some languages you can pass a list to the `disable` option.
|
||||||
For more fine-grained control, `cond` takes a function and whenever it returns
|
For more fine-grained control, `condition` takes a function and whenever it returns
|
||||||
`false` the module is disabled for that buffer.
|
`false` the module is disabled for that buffer.
|
||||||
The `cond` function is called once when a module starts in a buffer and
|
The `condition` function is called once when a module starts in a buffer and
|
||||||
received the language and the buffer number as arguments.
|
received the language and the buffer number as arguments.
|
||||||
|
|
||||||
>
|
>
|
||||||
|
|
@ -88,7 +89,7 @@ received the language and the buffer number as arguments.
|
||||||
highlight = {
|
highlight = {
|
||||||
enable = true,
|
enable = true,
|
||||||
disable = { "cpp", "lua" },
|
disable = { "cpp", "lua" },
|
||||||
cond = function(lang, bufnr) -- Disable in large C++ buffers
|
condition = function(lang, bufnr) -- Disable in large C++ buffers
|
||||||
return not (lang == "cpp" and api.nvim_buf_line_count(bufnr) > 50000)
|
return not (lang == "cpp" and api.nvim_buf_line_count(bufnr) > 50000)
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -351,7 +351,7 @@ function M.is_enabled(mod, lang, bufnr)
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
if module_config.cond and not module_config.cond(lang, bufnr) then
|
if module_config.condition and not module_config.condition(lang, bufnr) then
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue