-
-
Notifications
You must be signed in to change notification settings - Fork 844
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Highlight definition can be slow and blocks cursor movement #151
Comments
Oh we can move that as an async method, to avoid blocking, maybe... |
@vigoux What's the nvim/lua api for making this async? I can take a look at this. |
@steelsojka, I never used it personnally, but I think that the help page is located at |
I think we just wait for lua support for jobs. There is a PR for it in Neovim. I think it was called You would start the async job with a counter and only perform the highlighting when its finished when the counter was not incremented in the mean time. This is easier to implement that directly using |
Most of the performance issue is coming from checking if the node is a reference when recursing over the tree. M.recurse_tree(scope_node, function(iter_node, _, next)
if vim.tbl_contains(references, iter_node) and M.get_node_text(iter_node)[1] == node_text then
table.insert(usages, iter_node)
end
next()
end) I'll find a better way to check if it's a reference |
I'll also make it async as well 👍 |
#154 This fixes a lot of the slowness when I was testing. I will explore making the api async as well, but this is probably a good solution for now. |
Is the issue still happening with latest master? If not, we will close this. |
Describe the bug
highlight_definitions
can be really slow if it does not find the definition in current scope but in one of the parent levels.This can be annoying since it blocks cursor movement while it is running.
To Reproduce
Open a big Python or C++ file with a lot of variable definitions (like this one https://i10git.cs.fau.de/pycodegen/pystencils/-/raw/master/pystencils/field.py)
Try to move over the individual letters of
@staticmethod
. It will not find a definition but quite a few usages. Cursor movement is blocked during the search of the definitions.Expected behavior
Cursor movement is smooth. Search for definitions is non-blocking
** Output of
:checkhealth nvim_treesitter
**```- OK:
- OK:
- OK: html parser found.
- WARNING: No
- ADVICE:
- Open an issue at https://github.com/nvim-treesitter/nvim-treesitter
- OK:
- OK: typescript parser found.
- OK:
- OK:
- OK: clojure parser found.
- WARNING: No
- ADVICE:
- Open an issue at https://github.com/nvim-treesitter/nvim-treesitter
- WARNING: No
- ADVICE:
- Open an issue at https://github.com/nvim-treesitter/nvim-treesitter
- OK: lisp parser found.
- WARNING: No
- ADVICE:
- Open an issue at https://github.com/nvim-treesitter/nvim-treesitter
- OK:
- OK: regex parser found.
- WARNING: No
- ADVICE:
- Open an issue at https://github.com/nvim-treesitter/nvim-treesitter
- OK:
- OK: c parser found.
- OK:
- OK:
- OK: nix parser found.
- WARNING: No
- ADVICE:
- Open an issue at https://github.com/nvim-treesitter/nvim-treesitter
- WARNING: No
- ADVICE:
- Open an issue at https://github.com/nvim-treesitter/nvim-treesitter
- OK: swift parser found.
- WARNING: No
- ADVICE:
- Open an issue at https://github.com/nvim-treesitter/nvim-treesitter
- WARNING: No
- ADVICE:
- Open an issue at https://github.com/nvim-treesitter/nvim-treesitter
- OK: java parser found.
- OK:
- OK:
- OK: python parser found.
- OK:
- OK:
- OK: yaml parser found.
- WARNING: No
- ADVICE:
- Open an issue at https://github.com/nvim-treesitter/nvim-treesitter
- WARNING: No
- ADVICE:
- Open an issue at https://github.com/nvim-treesitter/nvim-treesitter
- OK: elm parser found.
- WARNING: No
- ADVICE:
- Open an issue at https://github.com/nvim-treesitter/nvim-treesitter
- WARNING: No
- ADVICE:
- Open an issue at https://github.com/nvim-treesitter/nvim-treesitter
- OK: vue parser found.
- WARNING: No
- ADVICE:
- Open an issue at https://github.com/nvim-treesitter/nvim-treesitter
- WARNING: No
- ADVICE:
- Open an issue at https://github.com/nvim-treesitter/nvim-treesitter
- OK: cpp parser found.
- OK:
- OK:
- OK: toml parser found.
- WARNING: No
- ADVICE:
- Open an issue at https://github.com/nvim-treesitter/nvim-treesitter
- WARNING: No
- ADVICE:
- Open an issue at https://github.com/nvim-treesitter/nvim-treesitter
- OK: lua parser found.
- OK:
- OK:
- OK: ruby parser found.
- OK:
- OK:
- OK: ocaml parser found.
- WARNING: No
- ADVICE:
- Open an issue at https://github.com/nvim-treesitter/nvim-treesitter
- WARNING: No
- ADVICE:
- Open an issue at https://github.com/nvim-treesitter/nvim-treesitter
- OK: go parser found.
- OK:
- OK:
- OK: scala parser found.
- WARNING: No
- ADVICE:
- Open an issue at https://github.com/nvim-treesitter/nvim-treesitter
- WARNING: No
- ADVICE:
- Open an issue at https://github.com/nvim-treesitter/nvim-treesitter
- OK: haskell parser found.
- WARNING: No
- ADVICE:
- Open an issue at https://github.com/nvim-treesitter/nvim-treesitter
- WARNING: No
- ADVICE:
- Open an issue at https://github.com/nvim-treesitter/nvim-treesitter
- OK: rust parser found.
- WARNING: No
- ADVICE:
- Open an issue at https://github.com/nvim-treesitter/nvim-treesitter
- OK:
- OK: json parser found.
- WARNING: No
- ADVICE:
- Open an issue at https://github.com/nvim-treesitter/nvim-treesitter
- OK:
- OK: markdown parser found.
- WARNING: No
- ADVICE:
- Open an issue at https://github.com/nvim-treesitter/nvim-treesitter
- WARNING: No
- ADVICE:
- Open an issue at https://github.com/nvim-treesitter/nvim-treesitter
- OK: javascript parser found.
- OK:
- OK:
- OK: css parser found.
- WARNING: No
- ADVICE:
- Open an issue at https://github.com/nvim-treesitter/nvim-treesitter
- OK:
- OK: julia parser found.
- WARNING: No
- ADVICE:
- Open an issue at https://github.com/nvim-treesitter/nvim-treesitter
- WARNING: No
- ADVICE:
- Open an issue at https://github.com/nvim-treesitter/nvim-treesitter
- OK: php parser found.
- WARNING: No
- ADVICE:
- Open an issue at https://github.com/nvim-treesitter/nvim-treesitter
- WARNING: No
- ADVICE:
- Open an issue at https://github.com/nvim-treesitter/nvim-treesitter
- OK: c_sharp parser found.
- WARNING: No
- ADVICE:
- Open an issue at https://github.com/nvim-treesitter/nvim-treesitter
- WARNING: No
- ADVICE:
- Open an issue at https://github.com/nvim-treesitter/nvim-treesitter
- OK: bash parser found.
- WARNING: No
- ADVICE:
- Open an issue at https://github.com/nvim-treesitter/nvim-treesitter
- OK:
- OK: tsx parser found.
- OK:
- OK:
health#nvim_treesitter#check
Installation
git
executable found.cc
executable found.html parser healthcheck
locals.scm
query found for htmlhighlights.scm
found.typescript parser healthcheck
locals.scm
found.highlights.scm
found.clojure parser healthcheck
locals.scm
query found for clojurehighlights.scm
query found for clojurelisp parser healthcheck
locals.scm
query found for lisphighlights.scm
found.regex parser healthcheck
locals.scm
query found for regexhighlights.scm
found.c parser healthcheck
locals.scm
found.highlights.scm
found.nix parser healthcheck
locals.scm
query found for nixhighlights.scm
query found for nixswift parser healthcheck
locals.scm
query found for swifthighlights.scm
query found for swiftjava parser healthcheck
locals.scm
found.highlights.scm
found.python parser healthcheck
locals.scm
found.highlights.scm
found.yaml parser healthcheck
locals.scm
query found for yamlhighlights.scm
query found for yamlelm parser healthcheck
locals.scm
query found for elmhighlights.scm
query found for elmvue parser healthcheck
locals.scm
query found for vuehighlights.scm
query found for vuecpp parser healthcheck
locals.scm
found.highlights.scm
found.toml parser healthcheck
locals.scm
query found for tomlhighlights.scm
query found for tomllua parser healthcheck
locals.scm
found.highlights.scm
found.ruby parser healthcheck
locals.scm
found.highlights.scm
found.ocaml parser healthcheck
locals.scm
query found for ocamlhighlights.scm
query found for ocamlgo parser healthcheck
locals.scm
found.highlights.scm
found.scala parser healthcheck
locals.scm
query found for scalahighlights.scm
query found for scalahaskell parser healthcheck
locals.scm
query found for haskellhighlights.scm
query found for haskellrust parser healthcheck
locals.scm
query found for rusthighlights.scm
found.json parser healthcheck
locals.scm
query found for jsonhighlights.scm
found.markdown parser healthcheck
locals.scm
query found for markdownhighlights.scm
query found for markdownjavascript parser healthcheck
locals.scm
found.highlights.scm
found.css parser healthcheck
locals.scm
query found for csshighlights.scm
found.julia parser healthcheck
locals.scm
query found for juliahighlights.scm
query found for juliaphp parser healthcheck
locals.scm
query found for phphighlights.scm
query found for phpc_sharp parser healthcheck
locals.scm
query found for c_sharphighlights.scm
query found for c_sharpbash parser healthcheck
locals.scm
query found for bashhighlights.scm
found.tsx parser healthcheck
locals.scm
found.highlights.scm
found.Output of
nvim --version
Additional context
Add any other context about the problem here.
The text was updated successfully, but these errors were encountered: