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

Add D Support #7332

Closed
wants to merge 2 commits into from
Closed

Add D Support #7332

wants to merge 2 commits into from

Conversation

kassane
Copy link

@kassane kassane commented Feb 3, 2024

Release Notes:

cc: @gdamore

@cla-bot cla-bot bot added the cla-signed The user has signed the Contributor License Agreement label Feb 3, 2024
@maxbrunsfeld
Copy link
Collaborator

@kassane Thanks for the PR! The language registry API has changed a bit on main. You now need to register the Tree-sitter grammar in a separate call, and then reference it by name in the language config.toml. So I think you may need to adjust your code slightly. Can you rebase or merge main, and test this again?

Also, could you include screenshots of the syntax highlighting and outline view?

Just a heads up - we are very soon going to be moving most of Zed's built-in languages into installable extensions (#7096). D is a major enough language that I'm ok with merging this in the meantime. But once the extension system lands, we will probably remove this code and put it into a new D repository under the new zed-extensions GitHub org. We'll probably add you as a collaborator on that repo when we do it, if you're interested in helping maintain it.

@kassane
Copy link
Author

kassane commented Feb 11, 2024

@kassane Thanks for the PR! The language registry API has changed a bit on main. You now need to register the Tree-sitter grammar in a separate call, and then reference it by name in the language config.toml. So I think you may need to adjust your code slightly. Can you rebase or merge main, and test this again?

Hi, @maxbrunsfeld 👋

Rebased again.

Note: In typos.toml needed add inout keywords for D (D v2.x) [inout - spec].

Also, could you include screenshots of the syntax highlighting and outline view?

Sadly, I have not uploaded any screenshots because macOS is not available. For the moment all I have available is Linux ( Linux support still in progress #7015).

However, based on tree-sitter-d support in another editor, it could probably be something similar.
Helix w/ tree-sitter-d:
image

Just a heads up - we are very soon going to be moving most of Zed's built-in languages into installable extensions (#7096). D is a major enough language that I'm ok with merging this in the meantime. But once the extension system lands, we will probably remove this code and put it into a new D repository under the new zed-extensions GitHub org. We'll probably add you as a collaborator on that repo when we do it, if you're interested in helping maintain it.

Great!! This will help a lot in organizing the project.

@maxbrunsfeld
Copy link
Collaborator

Ok, I’d like some D user to actually test this before merging. Could someone who is awaiting this feature help out with this PR by just manually testing a bit, and adding screenshots of the syntax highlighting and outline view?

@gdamore
Copy link

gdamore commented Feb 11, 2024 via email

@gdamore
Copy link

gdamore commented Feb 11, 2024 via email

@gdamore
Copy link

gdamore commented Feb 14, 2024

It appears to test this, I need to actually build zed? Or are there test binaries I can try somewhere?

@kassane
Copy link
Author

kassane commented Feb 15, 2024

It appears to test this, I need to actually build zed? Or are there test binaries I can try somewhere?

Currently just building zed.

@gdamore
Copy link

gdamore commented Feb 16, 2024

I did install, but was unable to test the LSP integration as the LSP release only includes artifacts for x86.

[2024-02-16T09:01:03-08:00 ERROR util] crates/zed/src/zed.rs:524: EOF while parsing a value at line 1 column 0
[2024-02-16T09:01:49-08:00 ERROR util] crates/zed/src/languages/d.rs:125: no cached binary
[2024-02-16T09:01:49-08:00 ERROR project] failed to start language server "serve-d": no asset found matching "serve-d_v0.7.6-osx-aarch64.tar.gz"
[2024-02-16T09:01:49-08:00 ERROR project] server stderr: Some("")
[2024-02-16T09:01:49-08:00 ERROR util] crates/zed/src/languages/d.rs:125: no cached binary
[2024-02-16T09:01:50-08:00 ERROR util] crates/zed/src/languages/d.rs:125: no cached binary
[2024-02-16T09:01:50-08:00 ERROR project] failed to start language server "serve-d": no asset found matching "serve-d_v0.7.6-osx-aarch64.tar.gz"
[2024-02-16T09:01:50-08:00 ERROR project] server stderr: Some("")
[2024-02-16T09:01:50-08:00 ERROR util] crates/zed/src/languages/d.rs:125: no cached binary
[2024-02-16T09:01:50-08:00 ERROR util] crates/zed/src/languages/d.rs:125: no cached binary
[2024-02-16T09:01:50-08:00 ERROR project] failed to start language server "serve-d": no asset found matching "serve-d_v0.7.6-osx-aarch64.tar.gz"
[2024-02-16T09:01:50-08:00 ERROR project] server stderr: Some("")
[2024-02-16T09:01:50-08:00 ERROR util] crates/zed/src/languages/d.rs:125: no cached binary
[2024-02-16T09:01:50-08:00 ERROR util] crates/zed/src/languages/d.rs:125: no cached binary
[2024-02-16T09:01:50-08:00 ERROR project] failed to start language server "serve-d": no asset found matching "serve-d_v0.7.6-osx-aarch64.tar.gz"
[2024-02-16T09:01:50-08:00 ERROR project] server stderr: Some("")

(The beta releases of serve-d do include arm64 artifacts.)

The Tree-Sitter integration appears good -- I'll paste up some syntax highlighting.

@gdamore
Copy link

gdamore commented Feb 16, 2024

Screenshot 2024-02-16 at 9 13 45 AM

@gdamore
Copy link

gdamore commented Feb 16, 2024

I'm not familiar with the outline view.

@gdamore
Copy link

gdamore commented Feb 16, 2024

Okay found reference to it as cmd-shift-O. I tried that in this buffer and it doesn't work -- does it depend on the LSP integration? Because if so that won't work on this ARM based Mac.

I will talk with the developer of the serve-d extension to see if he can release an ARM binary for the latest "release", or possibly cut another new release.

@kassane
Copy link
Author

kassane commented Feb 29, 2024

@maxbrunsfeld, Zed no have xz unpack?

Caused by:
    Invalid gzip header
[2024-02-29T10:30:39-03:00 ERROR project] server stderr: Some("")
[2024-02-29T10:30:40-03:00 ERROR util] crates/languages/src/d.rs:128: no cached binary
[2024-02-29T10:30:41-03:00 ERROR util] crates/languages/src/d.rs:128: no cached binary
[2024-02-29T10:30:41-03:00 ERROR project] failed to start language server "serve-d": failed to iterate over archive

Linux - Preview
image

@kassane
Copy link
Author

kassane commented Feb 29, 2024

I will talk with the developer of the serve-d extension to see if he can release an ARM binary for the latest "release", or possibly cut another new release.

cc: @WebFreak001

@ConradIrwin
Copy link
Member

Closing this for now. Language server support for extensions will land soon, which should make this easier. Sorry for the slow response!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla-signed The user has signed the Contributor License Agreement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

D
4 participants