Skip to content
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

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

Closed
renews opened this issue May 25, 2024 · 14 comments · Fixed by #13
Closed

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

renews opened this issue May 25, 2024 · 14 comments · Fixed by #13

Comments

@renews
Copy link

renews commented May 25, 2024

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
Copy link
Member

mrcjkb commented May 25, 2024

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.

@renews
Copy link
Author

renews commented May 25, 2024

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
Copy link
Member

mrcjkb commented May 25, 2024

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

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
Copy link
Author

renews commented May 25, 2024

I’m using the latest one, my because I’m on Mac with intel?

@mrcjkb
Copy link
Member

mrcjkb commented May 25, 2024

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.

local parser_extension = (sysname:find("windows") and "dll") or (sysname:find("darwin") and "dylib") or "so"

@mrcjkb mrcjkb changed the title Treesitter re-installs parsers every time I open a relevant file [macos] Treesitter re-installs parsers every time I open a relevant file May 25, 2024
@mrcjkb mrcjkb linked a pull request May 25, 2024 that will close this issue
@mrcjkb
Copy link
Member

mrcjkb commented May 25, 2024

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

@renews
Copy link
Author

renews commented May 26, 2024

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
Copy link
Member

mrcjkb commented May 26, 2024

🤔 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
Copy link
Author

renews commented May 26, 2024

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

@mrcjkb
Copy link
Member

mrcjkb commented May 26, 2024

You still have the old version installed.
The new version doesn't search for dylib on macos:

local parser_extension = (sysname:find("windows") and "dll") or "so"

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

@renews
Copy link
Author

renews commented May 26, 2024

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
Copy link
Member

mrcjkb commented May 26, 2024

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

@renews
Copy link
Author

renews commented May 26, 2024

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

@mrcjkb
Copy link
Member

mrcjkb commented May 26, 2024

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 🙏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants