-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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
Add syntax highlighting and LSP (erlang_lsp) for Erlang #7093
Add syntax highlighting and LSP (erlang_lsp) for Erlang #7093
Conversation
We require contributors to sign our Contributor License Agreement, and we don't have @codeadict on file. You can sign our CLA at https://zed.dev/cla. Once you've signed, post a comment here that says '@cla-bot check'. |
1 similar comment
We require contributors to sign our Contributor License Agreement, and we don't have @codeadict on file. You can sign our CLA at https://zed.dev/cla. Once you've signed, post a comment here that says '@cla-bot check'. |
8943758
to
3f9366e
Compare
7c5f3ec
to
31587bf
Compare
"undef" | ||
"unit" | ||
"when" | ||
"xor"] @keyword |
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.
Do we need to move and
, or
, not
, and xor
to @keyword.operator
since it's the same as andalso
and orelse
?
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.
31587bf
to
21c7f82
Compare
This is ready for review now. Have tested it with a few big Erlang projects and is working great. |
0d2dda2
to
64052a0
Compare
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.
Great scm files, thank you for creating a PR.
There are a few style nits and one odd "gitmodules": "vcs",
file association removal, which does not look right.
Let's fix all together and merge this?
One other thing I'm interested about: I have tried to run the branch, with zero Erlang experience before.
and no erlang-related entries in Zed's LSP logs. What am I doing wrong? If nothing seems so, could you try removing that language directory locally, and recheck that part? |
@SomeoneToIgnore As far as I know, the adaper didn't download the |
Oh, I see that https://github.com/erlang-ls/erlang_ls/releases/tag/0.50.0 does not have any mac binaries, so that's why, most probably: Zed does not have the code to download LSP server binaries elsewhere. |
(callback fun: (atom) @function) | ||
|
||
;; wild attribute | ||
(wild_attribute name: (attr_name name: (atom) @keyword)) |
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.
I found a bit of weird highlighting for wild_attribute
node. It got highlighted as an atom
(string.special.symbol) like screenshot below.
You can see that -dialyzer
should be highlight as same as -record
and friends. After moving the wild_attribute
node to under atom
at line 229, it works.
I'm not sure if it's the right fix. My tree-sitter knowledge is limited.
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.
Submit a fix at codeadict#1. 🙇
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.
I think the problem here is that dialyzer is not defined as a keyword and acts as an atom
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.
Thanks for the help @wingyplus and @SomeoneToIgnore . I'll rebase with |
Fixes by moving all primitive types to the top of file. Signed-off-by: Thanabodee Charoenpiriyakij <[email protected]>
Signed-off-by: Thanabodee Charoenpiriyakij <[email protected]>
Signed-off-by: Thanabodee Charoenpiriyakij <[email protected]>
ce0530b
to
a3491ec
Compare
LGTM! 👌 |
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.
Awesome to see such cooperative desire to bring this in, so let's do that.
Good luck with the macOs langserver releases!
Thank you @SomeoneToIgnore and @wingyplus for the help. More things to come for Erlang soon... |
Thanks for the heads up @codeadict . Anything you'd need from us to get WhatsApp's ELP integration rolling? |
Hi @eproxus, sorry for a bit late. I think we can modify the highlight query to support the function. I remember I have been doing this before this PR opened. So I will find the time in this week to make it better. 🙇♂️ |
@wingyplus Do you know if it is possible with tree sitter and Zed to highlight all the differences mentioned?
|
@eproxus - I have been out for a while, busy with work. I saw your message on the Erlang Slack, I'll be looking into highlighting the differences you mentioned. Will also add support for the ELP LS that has semantic highlighting support and can help with these things too. |
@codeadict Not stress |
;; | ||
|
||
|
||
;; First match wins in this file |
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.
Seems like in zed topmost queries have lower priority. I.e. (atom) @string.special.symbol
in this file overrides color for (call expr: (atom) @function)
This pull request implements support for the Erlang Language.
It adds:
highlights (Licensed under Apache-2 from WhatsApp which is compatible with Zed licensing model), folds and indents
Fixes #4939, possibly a duplicate of #7085 with more features. Suppose @wingyplus wants to join efforts here.
To complete (out of scope for this PR):
indentNextLinePattern
in VS CodeScreenshots:
Outline:
Release Notes: