-
Notifications
You must be signed in to change notification settings - Fork 464
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(treesitter): lessened performance restrictions (#1305)
* feat(treesitter): lessened performance restrictions This commit lifts some of the performance restrictions previously imposed on Treesitter when incremental parsing was not yet supported. Specifically: Treesitter will now only be disabled by default for files exceeding 7,500 lines or 2 MiB in size. Testing on an Intel i9-9880H with an APPLE SSD AP1024N shows noticeable lag at these thresholds. Signed-off-by: Jint-lzxy <[email protected]> * fixup: return correct value. --------- Signed-off-by: Jint-lzxy <[email protected]> Co-authored-by: ayamir <[email protected]>
- Loading branch information
Showing
4 changed files
with
25 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,7 +9,10 @@ return vim.schedule_wrap(function() | |
highlight = { | ||
enable = true, | ||
disable = function(ft, bufnr) | ||
if vim.tbl_contains({ "vim" }, ft) then | ||
if | ||
vim.tbl_contains({ "gitcommit" }, ft) | ||
or (vim.api.nvim_buf_line_count(bufnr) > 7500 and ft ~= "vimdoc") | ||
then | ||
return true | ||
end | ||
|
||
|
@@ -21,6 +24,7 @@ return vim.schedule_wrap(function() | |
textobjects = { | ||
select = { | ||
enable = true, | ||
lookahead = true, | ||
keymaps = { | ||
["af"] = "@function.outer", | ||
["if"] = "@function.inner", | ||
|
@@ -30,7 +34,7 @@ return vim.schedule_wrap(function() | |
}, | ||
move = { | ||
enable = true, | ||
set_jumps = true, -- whether to set jumps in the jumplist | ||
set_jumps = true, | ||
goto_next_start = { | ||
["]["] = "@function.outer", | ||
["]m"] = "@class.outer", | ||
|
@@ -55,8 +59,8 @@ return vim.schedule_wrap(function() | |
require("nvim-treesitter.install").prefer_git = true | ||
if use_ssh then | ||
local parsers = require("nvim-treesitter.parsers").get_parser_configs() | ||
for _, p in pairs(parsers) do | ||
p.install_info.url = p.install_info.url:gsub("https://github.com/", "[email protected]:") | ||
for _, parser in pairs(parsers) do | ||
parser.install_info.url = parser.install_info.url:gsub("https://github.com/", "[email protected]:") | ||
end | ||
end | ||
end) |