zed
zed copied to clipboard
Deno support
Is your feature request related to a problem? Please describe.
There's no way to use the Deno language server (deno lsp) which means Zed doesn't support most of my personal projects.
Describe the solution you'd like A way to configure the language server that gets used
Describe alternatives you've considered Currently the only alternative is use an editor that supports setting the language server, eg. vim/vscode
We have @slightknack working on allowing users to bring their own language servers.
Is there an ETA on this?
I think automatically switching to Deno's LSP if there's a deno.json or deno.jsonc in the root would be great. I'd hope there would be a configuration option outside of that, but this would be a great start. This is the only thing stopping me from moving to zed right now (I currently switch between Zed and Lapce depending on whether it's a Deno project or not)!
A possibility to choose the LSP for each separate language in the settings perhaps? Like in VSC where you can enable to always use Deno LSP in TypeScript projects.
2024 bump
Not on the Zed team, but I can tell you this is important to them! After all, what’s a code editor if you can’t use it for what you want to use it for? But with the zed2/GPUI2 transition nearing completion, the focus is more around stability and polishing the codebase right now. So, this will get done, but there have been other priorities that needed to be addressed first.
@clo4 is right! Supporting things like Deno is hugely important to us, we just need to finish off this transition for GPUI2 and the open source checklist (soooo very close!). We will switch back to building big fun features after that, and you all can join us in building some features out too, if you'd like!
@maxbrunsfeld I think we can close this now.
It'd make more sense to close once the Deno feature is actually in the released app, no?
Deno's LSP isn't fully integrated yet. Maybe we wait until we hit feature parity (or close) with vscode_deno?
I'd wait until the feature has properly launched. Can't wait to start having better support for Deno, since I'm using Deno daily for my own projects.
This is available in Zed v0.121.0.
I'm still getting red squiggles on that version.
@NetOpWibby
I'm still getting red squiggles on that version.
Deno is off by default.
I had to add "deno": { "enable": true } to my global settings. Adding it to the folder-specific settings did not work.
Okay I have that working but now I'm getting these errors for valid code. My import_map.json sets up these import paths.
Okay I have that working but now I'm getting these errors for valid code. My
import_map.jsonsets up these import paths.
You probably need to add that to your deno.json/deno.jsonc file.
You can either put it right in your deno.json:
{
"imports": { "std/": "https://deno.land/[email protected]/" }
}
or use a separate import map file:
{
"importMap": "import_map.json"
}
I downloaded this pre release, then set ~/.config/zed/settings.json this:
{
"theme": "One Dark",
"vim_mode": true,
"ui_font_size": 12,
"buffer_font_size": 12,
"deno": { "enable": true }
}
and refresh the zed, but the lsp didn't started at the LSP logs.
@igorbrasileiro your setup works for me. You do have to quit and restart Zed after enabling Deno. Or run the "workspace: restart" command. The "editor: restart language server" command does not switch over from the typescript to the deno language server.
Also, in the "debug: language server logs" page, slightly confusingly there's a a dropdown at the top to choose between language servers. Is deno-language-server in that dropdown?
@igorbrasileiro your setup works for me. You do have to quit and restart Zed after enabling Deno. Or run the "workspace: restart" command. The "editor: restart language server" command does not switch over from the typescript to the deno language server.
Also, in the "debug: language server logs" page, slightly confusingly there's a a dropdown at the top to choose between language servers. Is
deno-language-serverin that dropdown?
Oh, thank you, yeah, after restar it worked. I thought it didn`t worked, but the delay was the deno lsp timeout
I’d love to improve this. Anyone @ me if you want to pair on it. Why do we need a restart?
On Fri, Feb 2, 2024 at 8:16 PM Igor Brasileiro @.***> wrote:
@igorbrasileiro https://github.com/igorbrasileiro your setup works for me. You do have to quit and restart Zed after enabling Deno. Or run the "workspace: restart" command. The "editor: restart language server" command does not switch over from the typescript to the deno language server.
Also, in the "debug: language server logs" page, slightly confusingly there's a a dropdown at the top to choose between language servers. Is deno-language-server in that dropdown?
Oh, thank you, yeah, after restar it worked. I thought it didn`t worked, but the delay was the deno lsp timeout
— Reply to this email directly, view it on GitHub https://github.com/zed-industries/zed/issues/5361#issuecomment-1925037443, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAAAN7MXDKNCGVK3ISQ5HHLYRWTX7AVCNFSM6AAAAABCJF56TSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSMRVGAZTONBUGM . You are receiving this because you commented.Message ID: @.***>
Seems like we can close this issue now - there's probably a lot of low hanging fruit that can be fixed, but Deno support has landed in main. From this point it's going to be more useful to create issues for the individual things that don't work so it's easier to track what needs to get done.
I agree with @clo4, let's close this issue out in favor of new issues for further fixes / enhancements.
It seems that the formatter doesn't use deno fmt yet. For now, I could use deno fmt by configuring it like below:
{
"deno": { "enable": true },
"format_on_save": "on",
"formatter": {
"external": {
"command": "deno",
"arguments": ["fmt", "-"]
}
}
}
For a monorepo setup, is there a way to configure the formatter based on the file paths in the workspace settings? For example if 2 out of 5 packages use Deno
started to get squilly lines in the latest deno version
this is in the stock-standard tutorial project for fresh
started to get squilly lines in the latest deno version
this is in the stock-standard tutorial project for fresh
If you show the diagnostics, the language server that reported is Typescript? I'm facing the same issue and the LS that's reporting is Typescript. The message:
typescript: Cannot find module 'deco/deps.ts' or its corresponding type declarations.
yeah weird @igorbrasileiro not sure why it happened but some people on discord helped me out https://discord.com/channels/684898665143206084/684898665151594506/1235814362388889601
basically you need to install the deno plugin from zed (it's version 0.0.1 ... and only have like 150 installs) and then disable the built-in typescript server by changing your settings:
{
"languages": {
"TypeScript": {
"language_servers": ["deno", "!typescript-language-server", "!eslint", "..."]
},
"TSX": {
"language_servers": ["deno", "!typescript-language-server", "!eslint", "..."]
}
}
}
Thanks for the tip @kewp – this had worked for a few weeks for me.
In the last few days, however, I’m getting TS errors all over my project 😢
EDIT: obvisouly the moment I posted this I discovered that there’s a new language server for TS that needs to be explcicitely disabled called vtsls since #13140
{
"languages": {
"TypeScript": {
"language_servers": [
"deno",
"!typescript-language-server",
+ "!vtsls",
"!eslint",
"..."
]
},
}
}
hey @mxdvl yeah I'm also having issues, not with your fix but with monorepos ... I need to be able to tell Zed "please use this language server for this directory", much like @andreasvirkus mentioned ...
I'm having issues when using dependencies from JSR
As you can see, the Deno plugin is loaded and working, but I cannot get type declarations.
What is interesting is that import suggestions work.
Edit:
I can get some functionality working by specifying the LSP to use:
"languages": {
"TypeScript": {
"language_servers": [
"deno"
]
}
}
However goto source always returns an empty document.
started to get squilly lines in the latest deno version
this is in the stock-standard tutorial project for fresh