nvim-neorocks / rocks-treesitter.nvim

A "just works" tree-sitter setup for rocks.nvim!
GNU General Public License v3.0
36 stars 4 forks source link

[macos] Treesitter re-installs parsers every time I open a relevant file #12

Closed renews closed 5 months ago

renews commented 5 months ago

https://share.cleanshot.com/BhpyrbXq

I recorded the video to make clear what is happening, basically every time I open vim again for that file type, it reinstall the tresitter parser.

Is there something wrong in my config? also in the video, let me know if I have to share something else.

Edit: I removed the ~/.local/share/nvim and ~/.cache/nvim too and still the same issue.

mrcjkb commented 5 months ago

Hey :wave:

It looks like rocks.nvim can't find your parser. What'ts the output of

:lua =vim.api.nvim_get_runtime_file("parser/toml.so", true)

?

Also, could you please attach a :Rocks log?

There should be a parser symlink in ~/.local/share/nvim/rocks/rocks_rtp.

renews commented 5 months ago

Hey šŸ‘‹

It looks like rocks.nvim can't find your parser. What'ts the output of

:lua =vim.api.nvim_get_runtime_file("parser/toml.so", true)

?

Also, could you please attach a :Rocks log?

There should be a parser symlink in ~/.local/share/nvim/rocks/rocks_rtp.

Hi šŸ‘‹šŸ» ! the result of the command is CleanShot 2024-05-25 at 17 47 20@2x

:Rocks log is empty

And the folder

CleanShot 2024-05-25 at 17 51 12

mrcjkb commented 5 months ago

Hey šŸ‘‹ It looks like rocks.nvim can't find your parser. What'ts the output of

Hi šŸ‘‹šŸ» ! the result of the command is CleanShot 2024-05-25 at 17 47 20@2x

That's very curious. If that command outputs a non-empty table, rocks-treesitter.nvim starts highlighting and doesn't try to install the parser

https://github.com/nvim-neorocks/rocks-treesitter.nvim/blob/09b24aa8b240e67655a2faf796665a1787e92fbf/lua/rocks_treesitter/highlight.lua#L97

So unless perhaps you're using an outdated version of this plugin, the only reason it would try to install the parsers has to be that it's returning an empty table when you open the file.

renews commented 5 months ago

Iā€™m using the latest one, my because Iā€™m on Mac with intel?

mrcjkb commented 5 months ago

Ha, that could indeed be the issue. You're possibly the first mac user using rocks-treesitter.nvim šŸ˜…

The plugin assumes that .dylib is the extension of the parsers (dynamically linked library), but in fact it's .so (static library), which is why the check is returning an empty list.

https://github.com/nvim-neorocks/rocks-treesitter.nvim/blob/09b24aa8b240e67655a2faf796665a1787e92fbf/lua/rocks_treesitter/highlight.lua#L13

mrcjkb commented 5 months ago

Should be fixed after a :Rocks update or :Rocks install rocks-treesitter.nvim (if you don't want to update your other plugins).

renews commented 5 months ago

It's me again... Looks like that did not solve the issue =/ I tried first with Rocks update, quit reopen nvim and nothing. Tried with the direct install too.

# [plugins]
# nvim-treesitter = "semver_version"  # e.g. "1.0.0"

# List of non-Neovim rocks.
# This includes things like `toml` or other lua packages.
[rocks]

# List of Neovim plugins to install alongside their versions.
# If the plugin name contains a dot then you must add quotes to the key name!
[plugins]
"rocks.nvim" = "2.29.0"
"feline.nvim"  = "1.6.2"
"rocks-treesitter.nvim" = "scm"
"rocks-git.nvim" = "1.5.1"
"rocks-config.nvim" = "1.6.0"
"telescope.nvim" = "scm"
"mini.nvim" = "scm"
nvim-web-devicons = "0.100"
auto-session = "2.0.1"

# Treesiter parsers
tree-sitter-elixir = "scm"
tree-sitter-vimdoc = "scm"
tree-sitter-toml = "scm"
tree-sitter-lua = "scm"

# Configs for our plugins
# https://github.com/nvim-neorocks/rocks-config.nvim
[config]
plugins_dir = "plugins/"
auto_setup = true 

[plugins."gitsigns.nvim"]
git = "lewis6991/gitsigns.nvim"

[plugins."neofusion.nvim"]
git = "diegoulloao/neofusion.nvim"

#### Rocks configs
[treesitter]
auto_highlight = "all"
auto_install = true

Maybe some other part of the Rocks ecosystem ins not handling the macOS correctly? Just asking this because I also had an issue with the self install script of Rocks that was related to its binaries.

mrcjkb commented 5 months ago

šŸ¤” could you please look into rocks_treesiter/highlight.lua in your rocks-treesitter install, and check if it still searches for a .dylib parser? (See the link I posted earlier).

renews commented 5 months ago

Looks correct CleanShot 2024-05-26 at 11 50 58@2x

mrcjkb commented 5 months ago

You still have the old version installed. The new version doesn't search for dylib on macos: https://github.com/nvim-neorocks/rocks-treesitter.nvim/blob/11662de286de6661aa2a0014253c9521663f73a7/lua/rocks_treesitter/highlight.lua#L13

I guess :Rocks update didn't update the dev plugin, which may be another bug I need to investigate.

renews commented 5 months ago

Just ruined a :checkhealth

Maybe this help on your investigation

vim.treesitter: require("vim.treesitter.health").check()

- Nvim runtime ABI version: 14
- OK Parser: lua                  ABI: 14, path: /Users/rene/.local/share/nvim/site/pack/luarocks/opt/tree-sitter-lua/parser/lua.so
- ERROR Parser "lua.so" failed to load (path: /Users/rene/.local/share/nvim/site/pack/luarocks/opt/tree-sitter-lua/parser/lua.so.dSYM): ....10.0/share/nvim/runtime/lua/vim/treesitter/language.lua:101: 'lua.so' is not a valid language name
- OK Parser: elixir               ABI: 14, path: /Users/rene/.local/share/nvim/site/pack/luarocks/opt/tree-sitter-elixir/parser/elixir.so
- ERROR Parser "elixir.so" failed to load (path: /Users/rene/.local/share/nvim/site/pack/luarocks/opt/tree-sitter-elixir/parser/elixir.so.dSYM): ....10.0/share/nvim/runtime/lua/vim/treesitter/language.lua:101: 'elixir.so' is not a valid language name
- OK Parser: toml                 ABI: 14, path: /Users/rene/.local/share/nvim/site/pack/luarocks/opt/tree-sitter-toml/parser/toml.so
- ERROR Parser "toml.so" failed to load (path: /Users/rene/.local/share/nvim/site/pack/luarocks/opt/tree-sitter-toml/parser/toml.so.dSYM): ....10.0/share/nvim/runtime/lua/vim/treesitter/language.lua:101: 'toml.so' is not a valid language name
- OK Parser: vimdoc               ABI: 14, path: /Users/rene/.local/share/nvim/site/pack/luarocks/opt/tree-sitter-vimdoc/parser/vimdoc.so
- ERROR Parser "vimdoc.so" failed to load (path: /Users/rene/.local/share/nvim/site/pack/luarocks/opt/tree-sitter-vimdoc/parser/vimdoc.so.dSYM): ....10.0/share/nvim/runtime/lua/vim/treesitter/language.lua:101: 'vimdoc.so' is not a valid language name
- OK Parser: bash                 ABI: 14, path: /usr/local/Cellar/neovim/0.10.0/lib/nvim/parser/bash.so
- OK Parser: c                    ABI: 14, path: /usr/local/Cellar/neovim/0.10.0/lib/nvim/parser/c.so
- OK Parser: lua                  ABI: 14, path: /usr/local/Cellar/neovim/0.10.0/lib/nvim/parser/lua.so
- OK Parser: markdown             ABI: 14, path: /usr/local/Cellar/neovim/0.10.0/lib/nvim/parser/markdown.so
- OK Parser: markdown_inline      ABI: 14, path: /usr/local/Cellar/neovim/0.10.0/lib/nvim/parser/markdown_inline.so
- OK Parser: python               ABI: 14, path: /usr/local/Cellar/neovim/0.10.0/lib/nvim/parser/python.so
- OK Parser: query                ABI: 14, path: /usr/local/Cellar/neovim/0.10.0/lib/nvim/parser/query.so
- OK Parser: vim                  ABI: 14, path: /usr/local/Cellar/neovim/0.10.0/lib/nvim/parser/vim.so
- OK Parser: vimdoc               ABI: 14, path: /usr/local/Cellar/neovim/0.10.0/lib/nvim/parser/vimdoc.so
- OK Parser: elixir               ABI: 14, path: /Users/rene/.local/share/nvim/rocks/rocks_rtp/parser/elixir.so
- ERROR Parser "elixir.so" failed to load (path: /Users/rene/.local/share/nvim/rocks/rocks_rtp/parser/elixir.so.dSYM): ....10.0/share/nvim/runtime/lua/vim/treesitter/language.lua:101: 'elixir.so' is not a valid language name
- OK Parser: lua                  ABI: 14, path: /Users/rene/.local/share/nvim/rocks/rocks_rtp/parser/lua.so
- ERROR Parser "lua.so" failed to load (path: /Users/rene/.local/share/nvim/rocks/rocks_rtp/parser/lua.so.dSYM): ....10.0/share/nvim/runtime/lua/vim/treesitter/language.lua:101: 'lua.so' is not a valid language name
- OK Parser: toml                 ABI: 14, path: /Users/rene/.local/share/nvim/rocks/rocks_rtp/parser/toml.so
- ERROR Parser "toml.so" failed to load (path: /Users/rene/.local/share/nvim/rocks/rocks_rtp/parser/toml.so.dSYM): ....10.0/share/nvim/runtime/lua/vim/treesitter/language.lua:101: 'toml.so' is not a valid language name
- OK Parser: vimdoc               ABI: 14, path: /Users/rene/.local/share/nvim/rocks/rocks_rtp/parser/vimdoc.so
- ERROR Parser "vimdoc.so" failed to load (path: /Users/rene/.local/share/nvim/rocks/rocks_rtp/parser/vimdoc.so.dSYM): ....10.0/share/nvim/runtime/lua/vim/treesitter/language.lua:101: 'vimdoc.so' is not a valid language name
mrcjkb commented 5 months ago

For now, try uninstalling and then installing rocks-treesitter.nvim

renews commented 5 months ago

Reinstalling seems to fix the issue. Thanks and sry for being the bringer of so many issues

mrcjkb commented 5 months ago

Reinstalling seems to fix the issue. Thanks and sry for being the bringer of so many issues

No problem, that's how software evolves šŸ˜„ Thanks for reporting šŸ™