tree-sitter-langs
tree-sitter-langs copied to clipboard
Update tree-sitter-swift
The https://github.com/tree-sitter/tree-sitter-swift repository's README says the repo is abandoned and one should use https://github.com/alex-pinkus/tree-sitter-swift instead.
This PR changes the repository reference to match.
script/compile and script/test is working 👍
Edit: Noticed the issue; fixes #72
Looks like this is failing on this test
Those tests are failing because the grammar only supports emojis when compiled using tree-sitter version 0.20.5 or newer. I recall from previous discussions that emacs-tree-sitter uses 0.19.5, so I think that's expected.
I'm pretty new with all things tree-sitter, so any advise from you how to best resolve the situation? E.g. wait for emacs-tree-sitter to update the dependency before considering to merge this?
Conversely, I'm pretty new to how the emacs-tree-sitter plugin works :)
Apart from not supporting emojis, the grammar behaves totally fine against older tree-sitter versions; there should be no issues merging this if there's some way to ignore those specific tests. It would still be a big improvement over what users are getting out-of-the-box today.
If it's not possible to ignore specific tests, I wonder if you could skip all of them; I run tests on every commit in CI and I still test highlight queries against 0.19.0, so the chance of breakage seems quite low.
This would also be a good reason to upgrade to a newer tree-sitter version, but I don't know what that entails :)
I've been using it for few weeks and it works great.
@alex-pinkus added some more keywords for highligtning. To get them themable we need to define them:
(defface tree-sitter-hl-face:repeat
'((t :inherit tree-sitter-hl-face:keyword
:foreground "#666bb2"))
"Face for loops (for, in etc)."
:group 'tree-sitter-hl-faces)
(defface tree-sitter-hl-face:parameter
'((t :inherit tree-sitter-hl-face:label
:foreground "#666bb2"))
"Face for parameters in function calls."
:group 'tree-sitter-hl-faces)
(defface tree-sitter-hl-face:conditional
'((t :inherit tree-sitter-hl-face:property
:foreground "#666bb2"))
"Face for if/switch."
:group 'tree-sitter-hl-faces)
(defface tree-sitter-hl-face:include
'((t :inherit tree-sitter-hl-face:property
:foreground "#666bb2"))
"Import/include face."
:group 'tree-sitter-hl-faces)
(defface tree-sitter-hl-face:boolean
'((t :inherit tree-sitter-hl-face:property
:foreground "#666bb2"))
"Face for true/false."
:group 'tree-sitter-hl-faces)
(defface tree-sitter-hl-face:keyword.return
'((t :inherit tree-sitter-hl-face:property
:foreground "#666bb2"))
"Face for 'return'."
:group 'tree-sitter-hl-faces)
(defface tree-sitter-hl-face:keyword.operator
'((t :inherit tree-sitter-hl-face:property
:foreground "#666bb2"))
"Face for operator."
:group 'tree-sitter-hl-faces)
(defface tree-sitter-hl-face:keyword.function
'((t :inherit tree-sitter-hl-face:property
:foreground "#666bb2"))
"Face for 'func' keyword."
:group 'tree-sitter-hl-faces)
I don't know where they belong, I've written my own "swift-mode" extensions that loads them the first time I enter a swift-buffer (along with setup of LSP (eglot). The foreground color is just a dummy though.
We should probably update the tree-sitter version used in the CI. It requires a bit of rework of our test script. Let me see if I can get to that soon ish :D.
Can you rebase this so the CI can test it? Thanks!
@jcs090218 Done. Updates the submodule HEAD as well
Thank you!