Open Z3NTL3 opened 6 months ago
you might not installed lsp from the log?
you might not installed lsp from the log?
The associated LSP's (should) automatically get installed when installing a language extension. I'd like to note that I do not think that this is the actual problem because Zed does install the appropiate LSP, however I am facing errors like: "cannot read LSP message headers", for most languages.
I am also having this issue with a fresh build, something changed recently that's causing this.
I think I found the problem, however I am unsure what file provides the dir.
Through my own debugging and in the log in your issue, these are the paths where the module "is not found"
From your log:
C:\\C:\\Users\\efdal\\AppData\\Local\\Zed\\extensions\\work\\html\\node_modules\\vscode-langservers-extracted\\bin\\vscode-html-language-server
From my log:
C:\\C:\\Users\\tommy\\AppData\\Local\\Zed\\extensions\\work\\html\\node_modules\\vscode-langservers-extracted\\bin\\vscode-html-language-server
I have verified the file does exist there but as you can see from the logs, we have this C:\\C:\\
, which I believe is the issue.
Also printing from tailwind.rs
inside get_cached_server_binary
, the "server_path" value has a node_modules folder inside a node_modules folder which I believe is wrong:
Server path: "C:\\Users\\tommy\\AppData\\Local\\Zed\\languages\\tailwindcss-language-server\\node_modules\\node_modules/.bin/tailwindcss-language-server"
Also printing from
tailwind.rs
insideget_cached_server_binary
, the "server_path" value has a node_modules folder inside a node_modules folder which I believe is wrong:
The duplicate "node_modules" is a problem for get_cached_server_binary
but on macos, this doesn't even seem to get used. In fetch_server_binary
, container_dir will be something like "...\AppData\Local\Zed\languages\tailwindcss-language-server". Fixing the wrong path-seperator makes it work (tailwind lsp specifically).
const SERVER_PATH: &'static [&'static str] = &[
"node_modules",
"@tailwindcss",
"language-server",
"bin",
"tailwindcss-language-server"
];
async fn fetch_server_binary(
&self,
latest_version: Box<dyn 'static + Send + Any>,
container_dir: PathBuf,
_: &dyn LspAdapterDelegate,
) -> Result<LanguageServerBinary> {
let latest_version = latest_version.downcast::<String>().unwrap();
//changed this v
let mut server_path = container_dir.clone();
for p in SERVER_PATH.iter() {
server_path = server_path.join(p);
}
and in get_cached_server_binary
let last_version_dir = last_version_dir.ok_or_else(|| anyhow!("no cached binary"))?;
//changed this v
let mut server_path = last_version_dir.clone();
for p in SERVER_PATH.iter() {
server_path = server_path.join(p);
}
I also changed the path to "node_modules/@tailwindcss/language-server/bin/tailwindcss-language-server" because on macos, the "tailwindcss-language-server" file is a symlink to the actual script but on windows the ".bin" folder's "tailwindcss-language-server" is a sh script.
This needs to be done for atleast the following files:
Same error here.
same issue here, any fix yet?
same issue here, any fix yet?
did you atleast try what beans42 said?
same issue here, any fix yet?
did you atleast try what beans42 said?
well, i did change the tailwind and emmet like said @beans42, but the emmet doesnt work, perhaps it has a different path? also i couldnt find async fetch_server_binary and get_cached_server_binary one for the emmet, so i only change the const SERVER_PATH: for the emmet like so : const SERVER_PATH: &'static [&'static str] = &[ "node_modules", "@emmettio", "language-server", "bin", "emmet-language-server" ]; but it still didnt worked, anything i did wrong?
same issue here, any fix yet?
did you atleast try what beans42 said?
well, i did change the tailwind and emmet like said @beans42, but the emmet doesnt work, perhaps it has a different path? also i couldnt find async fetch_server_binary and get_cached_server_binary one for the emmet, so i only change the const SERVER_PATH: for the emmet like so : const SERVER_PATH: &'static [&'static str] = &[ "node_modules", "@emmettio", "language-server", "bin", "emmet-language-server" ]; but it still didnt worked, anything i did wrong?
well if its different you'll have to do it a bit different, but the logic stays the same. so you can change and write the code yourself or wait for someone else to do so.
Well, I noticed the same error in tailwind... invalid LSP message header "Windows PowerShell\r\nCopyright (C) Microsoft Corporation. All rights reserved.\r\n\r\n"
And it seems to me that the problem is because powershell spits out it's greeting message to standard output, which then confuses the LSP ???
Indeed, when i change line 28 in tailwind.rs to: vec!["-nologo".into(), server_path.into(), "--stdio".into()]
basically adding "-nologo" parameter, the error is gone from the logs...
I'm facing the same issue, however, I got it fixed for tailwind in #17741
I'm having the same issue on latest build.
Hi, I was having the same error with several LSPs. For example, when Zed tried to start a new LSP for Svelte, it threw the following error:
2024-10-15T21:08:45.5659771+02:00 [INFO] starting language server process. binary path: "C:\\Program Files\\nodejs\\node.exe", working directory: "I:\\ProyectosWeb\\GrowFund", args: ["/C:\\Users\\joell\\AppData\\Local\\Zed\\extensions\\work\\svelte/node_modules/svelte-language-server/bin/server.js", "--stdio"]
2024-10-15T21:08:45.6236236+02:00 [ERROR] cannot read LSP message headers
2024-10-15T21:08:45.6239995+02:00 [ERROR] Failed to start language server "svelte-language-server": oneshot canceled
2024-10-15T21:08:45.6241354+02:00 [ERROR] server stderr: "node:internal/modules/cjs/loader:1080\r\n throw err;\r\n ^\r\n\r\nError: Cannot find module 'I:\\C:\\Users\\joell\\AppData\\Local\\Zed\\extensions\\work\\svelte\\node_modules\\svelte-language-server\\bin\\server.js'\r\n at Module._resolveFilename (node:internal/modules/cjs/loader:1077:15)\r\n at Module._load (node:internal/modules/cjs/loader:922:27)\r\n at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:86:12)\r\n at node:internal/main/run_main_module:23:47 {\r\n code: 'MODULE_NOT_FOUND',\r\n requireStack: []\r\n}\r\n\r\nNode.js v18.18.0\r\n"
The problem is that in the args, Zed somehow adds a slash at the beginning, letting Windows take that slash as the root of the working directory, leaving the result as I:\C:\ in my case.
The workaround until a solid one arrives, is as follows: Add a replace in the arg variable to change the slash in crates/extension/src/extension_lsp_adapter.rs line 91.
Old:
Ok(LanguageServerBinary {
path,
arguments: command.args.into_iter().map(|arg| arg.into()).collect(),
env: Some(command.env.into_iter().collect()),
})
New:
Ok(LanguageServerBinary {
path,
arguments: command.args.into_iter().map(|arg| arg.replace("/C:\\", "C:\\").into()).collect(),
env: Some(command.env.into_iter().collect()),
})
Now, the log prints the following:
2024-10-15T23:31:25.6712345+02:00 [INFO] starting language server process. binary path: "C:\\Program Files\\nodejs\\node.exe", working directory: "I:\\ProyectosWeb\\GrowFund", args: ["C:\\Users\\joell\\AppData\\Local\\Zed\\extensions\\work\\svelte/node_modules/svelte-language-server/bin/server.js", "--stdio"]
As a result, Svelte suggestions/imports and Emmet inside .svelte files works perfectly.
I'm posting this comment because it worked for me and I'll be glad if it helps anyone else. I know this is a crappy solution, but at least, the extensions are working on Windows.
If anyone has another solution, I would be happy to see it.
Got this error message if I change it to the following @JoelDoryoku answer 🤔
Got this error message if I change it to the following @JoelDoryoku answer 🤔
Me too with PHP and HTML extensions. My solution worked for me with Astro, Svelte and SCSS extensions.
In this error, it looks like Zed is trying to run a bash script on windows. Maybe related to the slash at the beginning of the arg.
@JoelDoryoku Solution doesn't seem to work for me.
Check for existing issues
Describe the bug / provide steps to reproduce it
Don't know, I just did compile to Windows and all suddenly most LSPs gave this error.
Environment
If applicable, attach your
~/Library/Logs/Zed/Zed.log
file to this issue.