Open xanderim opened 3 months ago
Fixed in #4
thanks @weastur, I've tried following the steps in your commit but I have the same problem
@xanderim Unfortunately, there are also at lease two issues, which I fixed in #3 and #6. As a quick workaround you can:
golangci-lint-langserver
manually (for example, on macOS this could be done with brew install golangci-lint-langserver
)$HOME/Library/Application\ Support/Zed/extensions/
, I'm not sure about other OS'sextensions->golangci-lint->manifest->language_servers->golangci-lint->languages
, and make the array equal to `["Go"]. So you get something like this
{
"extensions": {
"golangci-lint": {
"manifest": {
"id": "golangci-lint",
"name": "Golangci-Lint",
"version": "0.1.0",
"schema_version": 1,
"description": "Golangci Lint support.",
"repository": "https://github.com/j4ng5y/zed_golangci_lint",
"authors": [
"Jordan Gregory <jordan@j4ng5y.dev>"
],
"lib": {
"kind": "Rust",
"version": null
},
"themes": [],
"languages": [],
"grammars": {},
"language_servers": {
"golangci-lint": {
"language": "Golangci Lint",
"languages": ["Go"],
"language_ids": {},
"code_action_kinds": null
}
},
"slash_commands": {},
"indexed_docs_providers": {},
"snippets": null
},
..............
But this file might be rewritten by Zed on any extension update/install etc.
Even with the above changes, I get the same error. I am on linux, not a mac though
1.
❯ which golangci-lint-langserver
/home/justin/go/bin/golangci-lint-langserver
2.
"lsp": {
"zls": {
"binary": {
"path": "/home/justin/.local/bin/zls"
}
},
"golangci-lint": {
"initialization_options": {
"command": [
"golangci-lint",
"run",
"--enable-all",
"--disable",
"lll",
"--out-format",
"json",
"--issues-exit-code=1"
]
}
}
},
"languages": {
"Go": {
"language_servers": ["gopls", "golangci-lint"]
}
}
id = "golangci-lint"
name = "Golangci-Lint"
description = "Golangci Lint support."
version = "0.1.0"
schema_version = 1
authors = ["Jordan Gregory <jordan@j4ng5y.dev>"]
repository = "https://github.com/j4ng5y/zed_golangci_lint"
[language_servers.golangci-lint]
name = "golangci-lint"
language = "Golangci Lint"
languages = ["Go"]
2024-08-27T21:11:54.55481555-04:00 [WARN] no language server found matching 'golangci-lint'
2024-08-27T21:11:54.55488198-04:00 [INFO] starting language servers for Go: gopls
Even with the above changes, I get the same error. I am on linux, not a mac though
I was able to get it running by doing the fix above and manually replacing extension.wasm from the repository. They are quite different (188KB vs 499KB). I guess that's tied to #6.
Even copying down his extension.wasm, the result is the same.
2024-08-28T22:37:29.809873837-04:00 [WARN] no language server found matching 'golangci-lint'
2024-08-28T22:37:29.809884908-04:00 [INFO] starting language servers for Go: gopls
2024-08-28T22:37:29.809898603-04:00 [WARN] no language server found matching 'golangci-lint'
@jseiser $HOME/Library/Application\ Support/Zed/extensions/installed/golangci-lint/extension.toml
...
[language_servers.golangci-lint]
language = "Golangci Lint"
languages = ["Go"] // change this line
...
Ya, its correct for me, but it still doesnt run. I assume its a Mac/Linux thing at this point?
❯ cat ~/.local/share/zed/extensions/installed/golangci-lint/extension.toml
id = "golangci-lint"
name = "Golangci-Lint"
version = "0.1.0"
schema_version = 1
description = "Golangci Lint support."
repository = "https://github.com/j4ng5y/zed_golangci_lint"
authors = ["Jordan Gregory <jordan@j4ng5y.dev>"]
themes = []
languages = ["Go"]
[lib]
kind = "Rust"
version = "0.0.6"
[grammars]
[language_servers.golangci-lint]
name = "golangci-lint"
language = "Golangci Lint"
languages = ["Go"]
[language_servers.golangci-lint.language_ids]
[slash_commands]
@jseiser
@mibesr
I removed it all, redid it all and same issue. If it wasnt clear, Im not on a Mac, so I assume there must be some difference there.
So both golangci-lint and golangci-lint-langserver are installed.
~/repos/test_echo [🐹 v1.23.0]
❯ golangci-lint-langserver
golangci-lint-langserver: connections opened
^C
~/repos/test_echo [🐹 v1.23.0]
❯ golangci-lint
Smart, fast linters runner.
Usage:
golangci-lint [flags]
golangci-lint [command]
Available Commands:
cache Cache control and information
completion Generate the autocompletion script for the specified shell
config Config file information
custom Build a version of golangci-lint with custom linters
help Help
linters List current linters configuration
run Run the linters
version Version
Flags:
--color string Use color when printing; can be 'always', 'auto', or 'never' (default "auto")
-h, --help Help for a command
-v, --verbose Verbose output
--version Print version
Use "golangci-lint [command] --help" for more information about a command.
The extension is installed
❯ ls -l ~/.local/share/zed/extensions/installed
drwxrwxr-x justin justin 4.0 KB Tue Sep 17 21:39:40 2024 golangci-lint
Extension.toml is updated
[language_servers.golangci-lint]
language = "Golangci Lint"
languages = ["Go"]
Tried with and w/out the extension.wasm from the MR.
Still doesnt work.
Removed it all, reinstalled it all from this fork https://github.com/snicol/zed_golangci_lint
Same result.
I have the same issue
Could you share some logging information?
If you open Command Palette
and use zed: open log
you should find some information.
On my end, I do see errors like [WARN] no language server found matching 'golangci-lint'
only to then see [INFO] starting language server process. binary path: "/opt/homebrew/bin/golangci-lint-langserver", working directory:...
later on and it works. Something to fix there.
If you are seeing it start but not working, check the LSP logs, by using debug: open language server logs
then in the dropdown menu select golangci-lint
's RPC messages. You should see some jsonrpc calls to the language server.
Aside, I've had no luck using this extension in a monorepo, where the root of the project didn't contain a go.mod.
OK, we are a monorepo, so I assume thats why i was broken. Using your fork, im able to work in a basic repo.
Hi @j4ng5y, thanks for the extension. From my understanding this extension launches "golangci-lint-langserver" so Zed can utilize it for linting. Unfortunately, due to my limited knowledge I couldn't make it work. Can you please give a quick look and point me into the right direction? Thanks.