Open conorvenus opened 2 months ago
Seems like a windows bug
its svelte language server specific issue I believe and the same happens with tailwindcss for me but for the other languages it does work fine
its svelte language server specific issue I believe and the same happens with tailwindcss for me but for the other languages it does work fine
I am unsure, because it does the same for HTML too for me - so I am thinking it must just be an issue with how the paths are formed on Windows within Zed for whatever reason.
its svelte language server specific issue I believe and the same happens with tailwindcss for me but for the other languages it does work fine
I am unsure, because it does the same for HTML too for me - so I am thinking it must just be an issue with how the paths are formed on Windows within Zed for whatever reason.
maybe but it has something to do with node modules how they handle directory I didn't have any issues with Zig extension
its svelte language server specific issue I believe and the same happens with tailwindcss for me but for the other languages it does work fine
I am unsure, because it does the same for HTML too for me - so I am thinking it must just be an issue with how the paths are formed on Windows within Zed for whatever reason.
maybe but it has something to do with node modules how they handle directory I didn't have any issues with Zig extension
Perhaps - by the looks of it to me, it seems to be a problem within Zed itself passing args as ['/C:\\...']
, that prepended /
shouldn't be there on Windows (and this is potentially the source of the issue)
Ok yeah, as I suspected, the prepended /
seems to be the source of the issue:
Ok(LanguageServerBinary {
path,
arguments: command.args.into_iter().map(|arg| arg.replace("/C:", "C:").into()).collect(),
env: Some(command.env.into_iter().collect()),
})
Here is a very rudimentary fix for my machine in extension_lsp_adapter.rs
, if somebody else who is more familiar with the Zed codebase could figure out where this /
on path names is coming from, please let me know.
Any updates on this? Other than this, the nightly build from https://github.com/deevus/zed-windows-builds seems to work fine.
I'm having the exact same issue with svelte's language server, seems to be a node issue, python's language server are working fine. I'm also using deevus nightly build from https://github.com/deevus/zed-windows-builds
Here's the log:
Language server error: svelte-language-server
oneshot canceled
-- stderr--
node:internal/modules/cjs/loader:1251
throw err;
^
Error: Cannot find module 'C:\C:\Users\Italo\AppData\Local\Zed\extensions\work\svelte\node_modules\svelte-language-server\bin\server.js'
at Module._resolveFilename (node:internal/modules/cjs/loader:1248:15)
at Module._load (node:internal/modules/cjs/loader:1074:27)
at TracingChannel.traceSync (node:diagnostics_channel:315:14)
at wrapModuleLoad (node:internal/modules/cjs/loader:217:24)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:166:5)
at node:internal/main/run_main_module:30:49 {
code: 'MODULE_NOT_FOUND',
requireStack: []
}
Node.js v22.8.0
Extension which is downloaded from extension store could not work for now, see #15004
A temp solution:
diff --git a/crates/extension/src/extension_lsp_adapter.rs b/crates/extension/src/extension_lsp_adapter.rs
index 25179acec..ccc1cbf5e 100644
--- a/crates/extension/src/extension_lsp_adapter.rs
+++ b/crates/extension/src/extension_lsp_adapter.rs
@@ -88,7 +88,17 @@ impl LspAdapter for ExtensionLspAdapter {
Ok(LanguageServerBinary {
path,
- arguments: command.args.into_iter().map(|arg| arg.into()).collect(),
+ arguments: command
+ .args
+ .into_iter()
+ .map(|arg| {
+ if let Some(arg) = arg.strip_prefix('/') {
+ arg.into()
+ } else {
+ arg.into()
+ }
+ })
+ .collect(),
env: Some(command.env.into_iter().collect()),
})
}
Extension which is downloaded from extension store could not work for now, see #15004
A temp solution:
diff --git a/crates/extension/src/extension_lsp_adapter.rs b/crates/extension/src/extension_lsp_adapter.rs index 25179acec..ccc1cbf5e 100644 --- a/crates/extension/src/extension_lsp_adapter.rs +++ b/crates/extension/src/extension_lsp_adapter.rs @@ -88,7 +88,17 @@ impl LspAdapter for ExtensionLspAdapter { Ok(LanguageServerBinary { path, - arguments: command.args.into_iter().map(|arg| arg.into()).collect(), + arguments: command + .args + .into_iter() + .map(|arg| { + if let Some(arg) = arg.strip_prefix('/') { + arg.into() + } else { + arg.into() + } + }) + .collect(), env: Some(command.env.into_iter().collect()), }) }
The problem exists elsewhere as well. The temporary solution does not work globally.
For astro it loads typescript_tsdk_path
with env::current_dir()
, but this does not pass by argument in the LanguageServerBinary
, so it still gives problems.
There should be a way to fix it without having to patch it. It is strange that the env::current_dir()
and subsequent instructions are causing this problem.
There should be a way to fix it without having to patch it. It is strange that the
env::current_dir()
and subsequent instructions are causing this problem.
From my understanding, the WASM
environment is some kind of sand-box, which has a unix-style file system. As a result, when calling current_dir()
within WASM
, the returned path will always begin with /
. Unfortunately, it seems there's no way to change this behavior.
The same happens for @astrojs/language-server
in Windows.
Language server error: astro-language-server
oneshot canceled
-- stderr--
node:internal/modules/cjs/loader:1051
throw err;
^
Error: Cannot find module 'C:\C:\Users\alvga\AppData\Local\Zed\extensions\work\astro\node_modules\@astrojs\language-server\bin\nodeServer.js'
at Module._resolveFilename (node:internal/modules/cjs/loader:1048:15)
at Module._load (node:internal/modules/cjs/loader:901:27)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:83:12)
at node:internal/main/run_main_module:23:47 {
code: 'MODULE_NOT_FOUND',
requireStack: []
}
Node.js v20.5.0
For some reason it has C:\C:\
.
The same happens for
@astrojs/language-server
in Windows.Language server error: astro-language-server oneshot canceled -- stderr-- node:internal/modules/cjs/loader:1051 throw err; ^ Error: Cannot find module 'C:\C:\Users\alvga\AppData\Local\Zed\extensions\work\astro\node_modules\@astrojs\language-server\bin\nodeServer.js' at Module._resolveFilename (node:internal/modules/cjs/loader:1048:15) at Module._load (node:internal/modules/cjs/loader:901:27) at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:83:12) at node:internal/main/run_main_module:23:47 { code: 'MODULE_NOT_FOUND', requireStack: [] } Node.js v20.5.0
For some reason it has
C:\C:\
.
Curious -- do you have multiple drives? I wonder if this is a multi-drive issue on Windows. Mine shows as D:\C:\
, as my projects are on D:\
The same happens for
@astrojs/language-server
in Windows.Language server error: astro-language-server oneshot canceled -- stderr-- node:internal/modules/cjs/loader:1051 throw err; ^ Error: Cannot find module 'C:\C:\Users\alvga\AppData\Local\Zed\extensions\work\astro\node_modules\@astrojs\language-server\bin\nodeServer.js' at Module._resolveFilename (node:internal/modules/cjs/loader:1048:15) at Module._load (node:internal/modules/cjs/loader:901:27) at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:83:12) at node:internal/main/run_main_module:23:47 { code: 'MODULE_NOT_FOUND', requireStack: [] } Node.js v20.5.0
For some reason it has
C:\C:\
.Curious -- do you have multiple drives? I wonder if this is a multi-drive issue on Windows. Mine shows as
D:\C:\
, as my projects are onD:\
My projects are in C:\
. I have an extra drive with letter E:\
.
The same happens for
@astrojs/language-server
in Windows.Language server error: astro-language-server oneshot canceled -- stderr-- node:internal/modules/cjs/loader:1051 throw err; ^ Error: Cannot find module 'C:\C:\Users\alvga\AppData\Local\Zed\extensions\work\astro\node_modules\@astrojs\language-server\bin\nodeServer.js' at Module._resolveFilename (node:internal/modules/cjs/loader:1048:15) at Module._load (node:internal/modules/cjs/loader:901:27) at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:83:12) at node:internal/main/run_main_module:23:47 { code: 'MODULE_NOT_FOUND', requireStack: [] } Node.js v20.5.0
For some reason it has
C:\C:\
.Curious -- do you have multiple drives? I wonder if this is a multi-drive issue on Windows. Mine shows as
D:\C:\
, as my projects are onD:\
My projects are in
C:\
. I have an extra drive with letterE:\
.
I'm starting to think that this might be caused by the assumption that the user has a single-drive system - maybe whatever call they make to get the file path returns just the path normally on a single drive system, and the path with the drive on multi drive systems?
I'll take a look this evening, as I'm not familiar with how it determines the path currently.
Check for existing issues
Describe the bug / provide steps to reproduce it
Whenever Zed attempts to start a language server, it seems to produce the wrong path to the
server.js
module:It can first be noticed in the
args: ["/C:\\..."]
with a prepended/
which thennode
seems to interpret as the module being located atC:\\C:\\...
In terms of reproducibility, I am unsure, I just built Zed on my machine, ran it and installed a few extensions and that was it.
Environment
Zed: v0.152.0 (Zed Dev 072513f59f54290d03424d8873a6e6dd46764b7e) OS: Windows 10.0.22631 Memory: 15.8 GiB Architecture: x86_64 GPU: Intel(R) Iris(R) Xe Graphics || Intel Corporation || 101.5989
If applicable, add mockups / screenshots to help explain present your vision of the feature
No response
If applicable, attach your Zed.log file to this issue.
Zed.log