Closed ghyatzo closed 8 months ago
Hey @ghyatzo
I believe this is a duplicate of https://github.com/sublime-treesitter/TreeSitter/issues/12, which was hopefully fixed by https://github.com/sublime-treesitter/TreeSitter/pull/13. I merged that PR but forgot to create a new tag after merging it =/
I just released https://github.com/sublime-treesitter/TreeSitter/releases/tag/1.5.2, which contains this fix
Ahah, no worries. Thanks for the quick update!
Actually, this may still be broken. Installing the tree_sitter
and tree_sitter_languages
libraries no longer works for me ever since this commit: https://github.com/sublime-treesitter/TreeSitter/commit/99daf371b4c95f0a0d449ba095cd715e1b4c85cb
Now I can't seem to install these "dependencies" with underscores or with dashes, i.e. as tree_sitter
or as tree-sitter
. Here's what PC logs when I try to install as tree_sitter
:
Package Control: Installing 3 libraries...
Package Control: The library "tree_sitter" is not available for Python 3.8
Package Control: The library "coverage" is not available for Python 3.3
Package Control: The library "tree_sitter_languages" is not available for Python 3.8
And when I try to install as tree-sitter
:
Package Control: Installing 3 libraries...
Package Control: Failed to install the library "tree-sitter" for Python 3.8: Unrecognized or incompatible source archive layout
Package Control: The library "coverage" is not available for Python 3.3
Package Control: Failed to install the library "tree-sitter-languages" for Python 3.8: Unrecognized or incompatible source archive layout
Not sure what Unrecognized or incompatible source archive layout means
I'm using a 2021 MBP m1, ST build 4169. I figure I'm using the latest version of PC, because I just uninstalled and reinstalled it an hour ago
Here's the commit that changed changed these library/dependency names in the new 4.0 PC channel
I don't understand PC 4 well enough to know what's going on here, but it seems that recent updates to PC may have caused this issue. Any ideas @kaste @deathaxe ?
Yeah, I can confirm that:
Interesting enough that it doesn't complain on my normal ST installation where I tested my PR. I guess only @deathaxe can tell.
The reason is https://github.com/wbond/package_control/blob/24b5ea51775500007a63c0bbba353530f1df2c59/package_control/package_manager.py#L1247 not using PEP491 escaped library name.
Ah, that makes sense. The official names (lib.name
) for the packages are e.g. "tree-sitter" but on the filesystem it's "tree_sitter".
Yeah. It also seems packages are matched case-insensitive.
@deathaxe, it sounds like this can be fixed in PC then? If so, is the fix fairly straightforward? Are there backwards compatibility concerns? Until this is fixed, it seems like there's no way to make the TreeSitter
package work OOTB, given that dependencies can't be installed no matter how they're named in dependencies.json
I've gotten accustomed to using TreeSitter for navigation and would rather not code without it, so I looked for a workaround yesterday and settled on commenting out the TreeSitter deps in dependencies.json
, installing these deps with pip
, then copying them into ~/Library/Application\ Support/Sublime\ Text/Lib/python38
(I'm on macOS)
This works for me, but I doubt others will want to do this 😐
Fixed by Package Control 4.0.4.
It now also accepts both tree-sitter
and tree_sitter
in dependencies.json as library names are treated fully according to PEP491 (escaped and case-insensitive).
I would definitely try to avoid these kind of manual copy pastes if possible. I tend to make a mess when doing it more often than I like to admit.
OT: @kylebebak Just out of curiosity, how are you navigating in sublime using treesitter? Setup custom keybinds that call the package API?
EDIT: installed new version, now I can install tree sitter as a dependency, but I get another error:
Package Control: Installed library "tree-sitter" 0.20.4 for Python 3.8
Package Control: Installed library "tree-sitter-languages" 1.10.2 for Python 3.8
Package Control: Installed package "TreeSitter" 1.5.2
ignored packages updated to: ["Vintage"]
reloading settings Packages/User/Package Control.sublime-settings
reloading settings Packages/User/Preferences.sublime-settings
reloading plugin TreeSitter.load
Tree-sitter: `python_path` not set, using language binaries bundled with tree_sitter_languages
Traceback (most recent call last):
File "/Applications/Sublime Text.app/Contents/MacOS/Lib/python38/sublime_plugin.py", line 432, in load_module
m.plugin_loaded()
File "/Users/cshen/Library/Application Support/Sublime Text/Packages/TreeSitter/load.py", line 38, in plugin_loaded
on_load()
File "/Users/cshen/Library/Application Support/Sublime Text/Packages/TreeSitter/src/core.py", line 141, in on_load
instantiate_languages()
File "/Users/cshen/Library/Application Support/Sublime Text/Packages/TreeSitter/src/core.py", line 247, in instantiate_languages
from tree_sitter import Language
File "/Users/cshen/Library/Application Support/Sublime Text/Lib/python38/tree_sitter/__init__.py", line 10, in <module>
from tree_sitter.binding import (
ModuleNotFoundError: No module named 'tree_sitter.binding'
It works on Windows. PC however also seems to choose windows variant on Linux for some odd reason. Need to look into it.
@ghyatzo Regarding the navigation question, yep, I've set up a bunch of TreeSitter key bindings. Here's a link to my key bindings (the same link is also in the README)
Fixed by PC 4.0.5
Works flawlessly now! Package Control: Install Pacakge
-> TreeSitter
-> TreeSitter: print tree
smooth as butter. Thanks a lot!
Awesome, thanks kylebebak! completely missed the link in the README sorry.
Can confirm that installing TreeSitter
and its dependencies worked for me as well, once PC was updated to the new 4.0.5 version. Thanks for fixing this so quickly @deathaxe =)
Off-topic: @kylebebak You should make a video of using the "cousins" feature. Can't make anything with it yet.
Hi, I've installed this package to start exploring a bit tree-sitter, but upon installation I get these messages in the log panel.
From my understanding these should be added already (https://github.com/sublime-treesitter/TreeSitter/issues/2#issue-2080455385), and a similar issue was addressed quite a while ago (#1), so It's probably an issue on my setup. I admit I don't really understand how package control dependencies work yet so I wouldn't even know where to start looking for a solution.
I am on a relatively fresh install of sublime on a WSL2 drive.