nvim-treesitter / nvim-treesitter/nvim-treesitter-textobjects
bug: slow textobject select queries for Rust
Nobody has claimed this yet.
- Dominant language
- Tree-sitter Query
- Stars
- 2.8k
- Forks
- 271
- Avg merge
- 8d 8h
- Merged PRs (30d)
- 1
Description
Describe the bug
Opening a buffer for any Rust file with textobject.select.enable = true option is very slow.
The time difference when opening an empty foo.rs file is very noticeable (on my setup it's around ~700ms).
To Reproduce
Steps to reproduce the behavior:
- Enable
selectplugin - Open a new rust file:
nvim foo.rs - Notice the long time to open the buffer
Expected behavior
I expect the buffer to open quickly, not slow enough to be noticeable.
Output of :checkhealth nvim-treesitter
nvim-treesitter: require("nvim-treesitter.health").check()
Installation ~
- WARNING `tree-sitter` executable not found (parser generator, only needed for :TSInstallFromGrammar, not required for :TSInstall)
- OK `node` found v20.12.1 (only needed for :TSInstallFromGrammar)
- OK `git` executable found.
- OK `cc` executable found. Selected from { vim.NIL, "cc", "gcc", "clang", "cl", "zig" }
Version: cc (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0
- OK Neovim was compiled with tree-sitter runtime ABI version 14 (required >=13). Parsers must be compatible with runtime ABI.
OS Info:
{
machine = "x86_64",
release = "5.15.133.1-microsoft-standard-WSL2",
sysname = "Linux",
version = "#1 SMP Thu Oct 5 21:02:42 UTC 2023"
} ~
Parser/Features H L F I J
- bash ✓ ✓ ✓ . ✓
- c ✓ ✓ ✓ ✓ ✓
- clojure ✓ ✓ ✓ . ✓
- comment ✓ . . . .
- css ✓ . ✓ ✓ ✓
- diff ✓ . . . .
- dockerfile ✓ . . . ✓
- elixir ✓ ✓ ✓ ✓ ✓
- git_config ✓ . . . .
- gitcommit ✓ . . . ✓
- gitignore ✓ . . . .
- go ✓ ✓ ✓ ✓ ✓
- gomod ✓ . . . ✓
- html ✓ ✓ ✓ ✓ ✓
- htmldjango ✓ . ✓ ✓ ✓
- javascript ✓ ✓ ✓ ✓ ✓
- json ✓ ✓ ✓ ✓ .
- lua ✓ ✓ ✓ ✓ ✓
- markdown ✓ . ✓ ✓ ✓
- markdown_inline ✓ . . . ✓
- python ✓ ✓ ✓ ✓ ✓
- query ✓ ✓ ✓ ✓ ✓
- requirements ✓ . . . ✓
- rust ✓ ✓ ✓ ✓ ✓
- terraform ✓ . ✓ ✓ ✓
- toml ✓ ✓ ✓ ✓ ✓
- tsx ✓ ✓ ✓ ✓ ✓
- typescript ✓ ✓ ✓ ✓ ✓
- vim ✓ ✓ ✓ . ✓
- vimdoc ✓ . . . ✓
- vue ✓ . ✓ ✓ ✓
- yaml ✓ ✓ ✓ ✓ ✓
Legend: H[ighlight], L[ocals], F[olds], I[ndents], In[j]ections
+) multiple parsers found, only one will be used
x) errors found in the query, try to run :TSUpdate {lang} ~
Output of nvim --version
NVIM v0.10.1-dev-32+g89fa1ee82
Build type: RelWithDebInfo
LuaJIT 2.1.1713484068
Run "nvim -V1 -v" for more info
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the delay by enabling textobject.select.enable and opening an empty foo.rs with nvim foo.rs. Start at the select plugin's Rust-related query or setup path and measure buffer-open time, then verify that the same reproduction no longer has a noticeable delay.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- performance, tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100