mirror of
https://github.com/neovim/neovim.git
synced 2026-08-31 03:13:48 +00:00
feat(treesitter): add filetype -> lang API
Problem:
vim.treesitter does not know how to map a specific filetype to a parser.
This creates problems since in a few places (including in vim.treesitter itself), the filetype is incorrectly used in place of lang.
Solution:
Add an API to enable this:
- Add vim.treesitter.language.add() as a replacement for vim.treesitter.language.require_language().
- Optional arguments are now passed via an opts table.
- Also takes a filetype (or list of filetypes) so we can keep track of what filetypes are associated with which langs.
- Deprecated vim.treesitter.language.require_language().
- Add vim.treesitter.language.get_lang() which returns the associated lang for a given filetype.
- Add vim.treesitter.language.register() to associate filetypes to a lang without loading the parser.
This commit is contained in:
@@ -182,8 +182,9 @@ void ui_refresh(void)
|
||||
local firstrun = q(1)
|
||||
local manyruns = q(100)
|
||||
|
||||
local factor = is_os('win') and 3 or 4
|
||||
-- First run should be at least 4x slower.
|
||||
assert(400 * manyruns < firstrun, ('firstrun: %d ms, manyruns: %d ms'):format(firstrun / 1000, manyruns / 1000))
|
||||
assert(factor * 100 * manyruns < firstrun, ('firstrun: %d ms, manyruns: %d ms'):format(firstrun / 1000, manyruns / 1000))
|
||||
end)
|
||||
|
||||
it('support query and iter by capture', function()
|
||||
|
||||
Reference in New Issue
Block a user