j4ng5y / zed_golangci_lint

Zed Extension for Golangci Lint
4 stars 5 forks source link

no language server found matching 'golangci-lint-langserver' #2

Open xanderim opened 1 month ago

xanderim commented 1 month ago

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.

image
weastur commented 1 month ago

Fixed in #4

xanderim commented 1 month ago

thanks @weastur, I've tried following the steps in your commit but I have the same problem

image
weastur commented 1 month ago

@xanderim Unfortunately, there are also at lease two issues, which I fixed in #3 and #6. As a quick workaround you can:

  1. Install golangci-lint-langserver manually (for example, on macOS this could be done with brew install golangci-lint-langserver)
  2. Find the extensions directory on your system. Again, for macOS this is $HOME/Library/Application\ Support/Zed/extensions/, I'm not sure about other OS's
  3. Find extensions->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.

jseiser commented 2 weeks ago

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
thecskin commented 2 weeks ago

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.

jseiser commented 2 weeks ago

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'
mibesr commented 4 days ago

@jseiser $HOME/Library/Application\ Support/Zed/extensions/installed/golangci-lint/extension.toml

...
[language_servers.golangci-lint]
language = "Golangci Lint"
languages = ["Go"] // change this line
...
jseiser commented 2 days ago

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]
mibesr commented 2 days ago

@jseiser

  1. Install Zed Extension for Golangci-Lint 1.1 https://github.com/j4ng5y/zed_golangci_lint/issues/2#issuecomment-2338077672
  2. Install Golangci-Lint and Golangci-Lint-Langserver 2.1 MacOS / Brew brew install golangci-lint golangci-lint-langserver 2.2 Install from Source export PATH=~/go/bin:$PATH go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest go install github.com/nametake/golangci-lint-langserver@latest