playground
playground copied to clipboard
Query editor not working?
The query editor doesn't seem to highlight anything:
I did see this other issue, which suggested making sure the query
grammar is installed, but I've already done that. Any other ideas?
Thanks!
Hi! It works for me... Can you execute :echo &ft
on the query buffer?
filetype is query
make sure that you have the query parser installed @joshfrench
I am having this same issue. I have the query parser installed too.
Same issue here too. query
parser is installed; ft
is query
. Is there any other information that would be helpful for diagnosing the issue?
Much like https://github.com/nvim-treesitter/playground/issues/51#issuecomment-915715794, the issue just magically resolved itself for me as well. I did poke some related config slightly, but I wasn't specifcally attempting to fix the issue.
In particular:
- I've been using
packer.nvim
, with the following treesitter configs:use { 'nvim-treesitter/nvim-treesitter', run = function() local ts_update = require('nvim-treesitter.install').update({ with_sync = true }) ts_update() end, } use { 'nvim-treesitter/playground', config = function() local ts = require('nvim-treesitter.configs') ts.setup { highlight = { enable = true, }, indent = { enable = true }, playground = { enable = true, disable = {}, updatetime = 25, persist_queries = false, keybindings = { -- probably not relevant }, }, } end, }
- Particularly note highlighting was enabled, but I hadn't been seeing any highlighting changes either. I assumed it just changed the highlighting algorithm without affecting visuals, but I see now that it simply wasn't working.
- I just added a new, unrelated plugin to the list of installed plugins
- I ran
PackerInstall
and thenPackerCompile
- I noticed that the status line printed something about the treesitter
query
parser already being installed, as part of the above packer commands - Shortly afterwards, I opened a C++ file (I also had the
cpp
parser installed from before). I noticed the syntax highlighting was very different from what I was used to. - I suspected something happened to treesitter, so I opened a Rust file (again, already installed the
rust
parser previously). The syntax highlighting was suddenly different there too. - Suspecting this issue was fixed too, I opened the playground next and wrote a simple query (
(identifier) @capture
). Hovering over@capture
highlighted all the identifiers in the source code.
TL;DR
I think PackerInstall
/PackerCompile
happened to fix it, but I'd definitely done those commands previously with no luck. That, plus the number of others with this issue, makes me believe there is something else going on behind the scenes.
The general syntax highlighting (outside of playground) issue I saw might be related? If you're still struggling with this issue I definitely recommend setting highlight = { enable = true }
in your config, as it'll be immediately obvious if that starts working. Without the syntax highlighting change I'm not sure I would have noticed that the playground started working.
I just spent 30mn trying to understand why this didn't work when the solution was as simple as installing the "query" grammar: let's add it to requirements https://github.com/nvim-treesitter/playground#requirements . I've fixed the nix package so that installing playground installs the "query" grammar as well.
I use Packer. Removing ~/.local/share/nvim/site/pack/packer/start/playground
, reinstalling and recompiling fixed it for me.
also note that in neovim master's you can now do :lua vim.treesitter.show_tree()