helix-editor / helix

A post-modern modal text editor.
https://helix-editor.com
Mozilla Public License 2.0
33.56k stars 2.49k forks source link

LSP fails to start on "Method not found.." error (clojure-lsp) #3767

Closed fedreg-bn closed 2 years ago

fedreg-bn commented 2 years ago

First off, amazing work on Helix everyone!! super impressive and fun to use!!

I'm trying out Helix with some LSPs and running into some issues I'm hoping someone has hit before...

This is specifically with the clojure-lsp...

When I open certain clojure projects I get these two error lines (no other logs) and the lsp does not initialize:

2022-09-09T15:07:22.109 helix_term::application [ERROR] Timed out waiting for language servers to shutdown                                                                  
   414 2022-09-09T15:07:29.945 helix_term::application [ERROR] Language Server: Method not found window/showMessageRequest

However, on some other projects, I get two similar lines but the lsp works just fine:

2022-09-09T15:10:30.552 helix_term::application [ERROR] Timed out waiting for language servers to shutdown                                                                  
     6 2022-09-09T15:10:57.614 helix_term::application [ERROR] Language Server: Method not found client/registerCapability 

nothing substantially different about the 2 projects as far as structure, root file, etc.. maybe just a size thing; haven't experimented enough.

is there something critical about the showMessageRequest method that causes the whole LSP not to work if not found?

The only other LSP I've tried on Helix (Elm) works great on all projects I've tried it on.

Any pointers? thx!!

version:

helix 22.08.1 (66276ce6) 

languages.toml:

[[language]]
name = "elm"
scope = "source.elm"
injection-regex = "^elm$"
file-types = ["elm"]
roots = ["elm.json"]
comment-token = "--"
indent = { tab-width = 2, unit = "  " }
language-server = { command = "elm-language-server", args = ["--stdio"] }
formatter = { command = "elm-format" , args = ["--stdin"] }

[[language]]
name = "clojure"
scope = "source.clojure"
injection-regex = "(clojure|clj|edn|boot)"
file-types = ["clj", "cljs", "cljc", "edn"]
roots = ["project.clj", "deps.edn", "shadow-cljs.edn"]
comment-token = ";;"
language-server = { command = "clojure-lsp" }
indent = { tab-width = 2, unit = "  " }

[[grammar]]
name = "clojure"
source = { git = "https://github.com/sogaiu/tree-sitter-clojure", rev = "e57c569ae332ca365da623712ae1f50f84daeae2" }
hx --health clojure

Configured language server: clojure-lsp
Binary for language server: /usr/local/bin/clojure-lsp
Configured debug adapter: None
Highlight queries: ✓
Textobject queries: ✘
Indent queries: ✘ 
fedreg-bn commented 2 years ago

Solved.

Turns out that the Clojure LSP tries to set up the whole class path and get all deps, etc.

Usually I have to configure my env before starting a repl but in this case, hadn't occurred to me that the lsp would need the same setup.

Properly setting the env up before starting the LSP made it work fine with helix.