-
Notifications
You must be signed in to change notification settings - Fork 22
Support customizing SymbolLookup for tree-sitter native library #61
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
Conversation
src/main/java/io/github/treesitter/jtreesitter/internal/ChainedLibraryLookup.java
Show resolved
Hide resolved
src/main/java/io/github/treesitter/jtreesitter/internal/ChainedLibraryLookup.java
Outdated
Show resolved
Hide resolved
src/main/java/io/github/treesitter/jtreesitter/internal/ChainedLibraryLookup.java
Show resolved
Hide resolved
|
I would appreciate your thoughts on this. @Marcono1234 @bioball |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To me this ServiceLoader approach looks quite useful. One small suggestion: It might be nice if NativeLibraryLookup#get could permit users to use their own Arena. (With the current implementation it seems that is possible, but it would be good if it was officially documented as supported.)
For example something like this:
/*
* ...
* @param arena an arena for the symbol lookup; library lookups can instead
* at their own risk use their own arena, but must make sure it is not
* closed while tree-sitter is still in use
* ...
*/
SymbolLookup get(Arena arena);For Windows this could be useful when loading the library from a temp file, because you can only delete the temp file when the library is unloaded (by calling Arena#close, so you need to provide your own Arena).
Would that be ok @ObserverOfTime?
src/main/java/io/github/treesitter/jtreesitter/internal/ChainedLibraryLookup.java
Show resolved
Hide resolved
ab995e8 to
7369f7f
Compare
|
This looks great! This is basically what I was looking for when I opened #36. |
|
Any updates on when this will be merged? |
|
After tree-sitter 0.25 is released. |
Enable clients to customize the SymbolLookup used for the tree-sitter native library. For example, clients can use this capability to embed the tree-sitter native library in their JAR, which is a common way to solve the native library distribution problem.
3846ad4 to
6867a75
Compare
To demonstrate that this PR solves a real problem, I've updated pkl-lsp here to no longer patch and build java-tree-sitter from source.
Motivation:
Changes:
Result: