-
Notifications
You must be signed in to change notification settings - Fork 40
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
make install
builds an inconsistent dylib
when grammar.js
changes
#229
Comments
This is happening because the compiled version of your external scanner is out of date. It must not have gotten updated when you switched to the latest. The (generated) The error will go away if you uninstall the grammar and then reinstall it. You may want to dig into the upgrade logic from the emacs tree sitter plugin to see how you got into this state. (How do I know this is the issue? The source code in the provided screenshot parses just fine for me using the latest grammar. However, I see the exact same parse errors you report if I manually revert the most recent changes to [Edited to remove some content about tree-sitter version that may mislead others into thinking that was the issue. This issue is not caused by, or related to, the use of any one version of tree-sitter vs another] |
Ok thanks for the explanation. I think they are checking the possibilities in using a new compiler (20.x). |
just to make sure we’re on the same page: the grammar still works with 0.19, you just need to fully uninstall and reinstall it to fix this issue. I don’t think that’s a versioning problem, it sounds like a bug in upgrade logic in general that will affect any grammar that has an external scanner. can you try that out and let me know if it works? It may even be helpful to list out the steps you follow so that others who come across this later know what to do. If it works after doing that, please close the issue. |
In Emacs I just rename your dylib file to "swift.dylib" and place in a folder. Same thing with queries. So I dont really see how this would change anything. It's dynamically loaded by Emacs when needed. |
Thank you for clarifying that! I'm not quite sure what "your dylib file" refers to -- I don't vend a dylib artifact. Are there steps you ran locally to create the dylib? I think that's where the bug lies -- that the dylib was created using old artifacts for the scanner (e.g. maybe it used a cached Since the latest grammar can parse the file you shared in a screenshot without any errors (with any version of tree-sitter you care to throw at it), I'm confident this isn't a widespread issue. If you're willing to try those steps, we can definitively confirm how future users can recover if they get into the same locally-inconsistent state. I totally understand if you'd rather not test it out, but unless you're up for confirming the theory, I don't really have further steps to help you. Apart from testing that out, is there anything else we should do before closing this issue? |
Hi!
|
Ah, got it! Did a make clean fix the issue for you? If so, there’s probably something I need to fix in the makefile that’s preventing it from autodetecting that the scanner has changed, but that does narrow down the problem! Great to see that PR, thanks for sharing it :) |
Yes, now it works again after I did a Do you have a list of which 'attributes' detected and supported in the tree-sitter-swift? I noticed that sometimes labels are shown. Btw here are the faces that Emacs detects now. Do you have any custom detections that you dont see in that list? I know that the other tree-sitter had some custom that you needed to add yourself. |
I see a few in
I don't know if the emacs detection is hierarchical (i.e. if it doesn't recognize |
Currently, a non-clean build after updating `grammar.js` will not pick up any new changes. This happens because as far as the makefile is concerned, `parser.c` is a source file, and it has not been updated. To fix this, we simply add a rule that can generate `parser.c`. If someone runs `make install` after `npm install`, this rule will do nothing, because the output file will already be newer. However, if someone updates the repo, this will ensure all artifacts get updated. Fixes #229
Currently, a non-clean build after updating `grammar.js` will not pick up any new changes. This happens because as far as the makefile is concerned, `parser.c` is a source file, and it has not been updated. To fix this, we simply add a rule that can generate `parser.c`. If someone runs `make install` after `npm install`, this rule will do nothing, because the output file will already be newer. However, if someone updates the repo, this will ensure all artifacts get updated. Fixes #229
make install
builds an inconsistent dylib
when grammar.js
changes
Thanks. Ill probably need to add them manually some how. |
I moved this conversation about highlight queries to a discussion so it doesn't get lost: #233 Most of the highlight queries actually come from the neovim folks, so I wonder if they have any advice on how to maintain a maximally-applicable subset in the upstream repository (i.e. here) and make lives as easy as possible for anyone integrating at the editor level (i.e. you). |
nvim-treesitter maintains its own version of |
I'm on the current main branch 58deb71df91bcee6d650774dbd136a7493ca20f
Here is the output with debug. Hope it helps
I didn't have them yesterday.
The text was updated successfully, but these errors were encountered: