mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-14 09:20:04 -04:00
refacto: deprecate used_by in parsers.lua
- remove print_warning function from utils.lua (unused) - cleanup some functions in parsers.lua (parameters overloading and wrong bufnr used). - log a deprecation notice when using used_by in a parser definition - default the filetype_to_parsername table to the list of filetypes previously in the used_by keys - update the README to indicate that change
This commit is contained in:
parent
d7eab3a5a9
commit
58a4897e6d
3 changed files with 37 additions and 37 deletions
11
README.md
11
README.md
|
|
@ -355,12 +355,19 @@ parser_config.zimbu = {
|
|||
generate_requires_npm = false, -- if stand-alone parser without npm dependencies
|
||||
requires_generate_from_grammar = false, -- if folder contains pre-generated src/parser.c
|
||||
},
|
||||
filetype = "zu", -- if filetype does not agrees with parser name
|
||||
used_by = {"bar", "baz"} -- additional filetypes that use this parser
|
||||
filetype = "zu", -- if filetype does not match the parser name
|
||||
}
|
||||
EOF
|
||||
```
|
||||
|
||||
If you wish to set a specific parser for a filetype, you should extend the `filetype_to_parsername` table:
|
||||
```vim
|
||||
lua <<EOF
|
||||
local ft_to_parser = require"nvim-treesitter.parser".filetype_to_parsername
|
||||
filetype_to_parsername.someft = "python" -- the someft filetype will use the python parser and queries.
|
||||
EOF
|
||||
```
|
||||
|
||||
4. Start `nvim` and `:TSInstall zimbu`.
|
||||
|
||||
You can also skip step 2 and use `:TSInstallFromGrammar zimbu` to install directly from a `grammar.js` in the top-level directory specified by `url`.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue