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

Update Swift language. Current is not the most active one. #72

Closed
konrad1977 opened this issue Jan 29, 2022 · 14 comments · Fixed by #118
Closed

Update Swift language. Current is not the most active one. #72

konrad1977 opened this issue Jan 29, 2022 · 14 comments · Fixed by #118
Labels
help wanted Extra attention is needed

Comments

@konrad1977
Copy link

konrad1977 commented Jan 29, 2022

Looks like this repo is the one that is undergoing active development, maybe switch to this one?

https://github.com/alex-pinkus/tree-sitter-swift

@konrad1977 konrad1977 reopened this Jan 29, 2022
@konrad1977 konrad1977 changed the title Update Swift language. Current repo is abonded Update Swift language. Current is not the most active one. Jan 29, 2022
@ubolonton
Copy link
Collaborator

Yeah. Can you try it out and open a pull request?

@konrad1977
Copy link
Author

konrad1977 commented Jan 29, 2022

Yeah that worked. Used the highlight.scm also. Now I can adjust highlightning. I am no ninja at git so I actually did a copy of the repo on disk and then run script/compile swift.

https://github.com/alex-pinkus/tree-sitter-swift this seems to be alot more mature than the previous one. Maybe update?

Its a bit slow. It takes some seconds to load a swift file. Can it be optimized with a compiler flag maybe? It's seems to be a debug version.

@alex-pinkus
Copy link

alex-pinkus commented Jan 29, 2022

FYI, query load time (especially for swift) is greatly improved if the grammar is generated using tree-sitter version 0.20.4 with the command tree-sitter generate --abi 14. See tree-sitter/tree-sitter#1589.

@konrad1977
Copy link
Author

Hi @alex-pinkus I think we cannot use anything above 19.5 for now, for comparbility reasons.

@konrad1977
Copy link
Author

I noticed that most of them can change :background but not :foreground. Any ideas why @ubolonton ? (in emacs when I setup my own theme.

@ubolonton
Copy link
Collaborator

I noticed that most of them can change :background but not :foreground.

This sounds like an issue with your (theme) setup. In any case, you would have better luck with one of these:

@ubolonton ubolonton added the help wanted Extra attention is needed label Feb 2, 2022
@woolsweater
Copy link

I also have a Swift grammar that I have been developing and using with emacs-tree-sitter for the past year: https://gitlab.com/woolsweater/tree-sitter-swifter . I was unaware of this other effort until now; I came here to mention mine and saw this issue instead. 😅

@konrad1977
Copy link
Author

@woolsweater How do I try out your grammar? How much difference does it do, I never got it work with Emacs and Swift and I am curious if it's worth the effort.

@woolsweater
Copy link

@konrad1977 I believe the best way to try any alternative grammar is to follow the tree-sitter-langs instructions for Building Grammars From Source. You would just change the appropriate language submodule to point to the alternative repo.

From there how you load it into Emacs depends on your choice of package manager. If you happen to use straight.el, I can point you to how I do it in my .emacs.d. I'm afraid I am not familiar enough with other managers to offer advice there.

@konrad1977
Copy link
Author

@woolsweater do you notice any slow downs? Could you share a screen shot with and without tree-sitter enabled? (Is it worth it)?

@woolsweater
Copy link

woolsweater commented Apr 16, 2022

@konrad1977 Good idea! I have added a README and some screenshots to my repo. I find the performance of elisp-tree-si/tter and my grammar to be a non-issue in daily use. It was already fine in Emacs 27 and pretty much everything seems snappier with 28 🙂 Using elisp-tree-sitter is definitely worth it, not just for Swift but for any supported language.

@woolsweater
Copy link

woolsweater commented Apr 16, 2022

@ubolonton elisp-tree-sitter does not support multiple grammars for a programming language, does it? I am unsure how best to handle this situation where there are two options. (I doubt that our grammars are mergeable or that it would even make sense to try to merge them.)

@konrad1977
Copy link
Author

konrad1977 commented Apr 20, 2022

@woolsweater I compiled it my self and got it working yesterday. Works great (almost all the time). Didn't notice any speed bumps but I'm currently on a M1 Max MBP.

@konrad1977
Copy link
Author

konrad1977 commented May 13, 2022

@ubolonton maybe its a good idea to change the language to @woolsweater version? The old one havent been updated in 3 years (and doesn't include any rules so its more or less useless). I havent tried @alex-pinkus version but it would be nice to try that one to. @woolsweater maybe you have compared your version with @alex-pinkus?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants