coc-julia icon indicating copy to clipboard operation
coc-julia copied to clipboard

couldn't create connection to server

Open Deeperand opened this issue 1 year ago • 1 comments

Problem Description

When I open a .jl file, coc-julia met error [coc.nvim] Julia Language Server client: couldn't create connection to server., looks it failed to connect the language server

Reproduce

I first install the following packages in Julia

(@v1.9) pkg> add LanguageServer SymbolServer StaticLint

then install coc-julia in NeoVim via

:CocInstall coc-julia

Platform Info

Julia info

julia> versioninfo()
Julia Version 1.9.3
Commit bed2cd540a1 (2023-08-24 14:43 UTC)
Build Info:
  Official https://julialang.org/ release
Platform Info:
  OS: macOS (arm64-apple-darwin22.4.0)
  CPU: 8 × Apple M1
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-14.0.6 (ORCJIT, apple-m1)
  Threads: 1 on 4 virtual cores

NeoVim info

nvim --version
NVIM v0.9.1
Build type: Release
LuaJIT 2.1.0-beta3

   system vimrc file: "$VIM/sysinit.vim"
  fall-back for $VIM: "/opt/homebrew/Cellar/neovim/0.9.1/share/nvim"

Run :checkhealth for more info

Additional Information

First, I'm sure the julia.executablePath json configuration of coc-json is as same as which julia output, i.e.

$ which julia
/usr/local/bin/julia

and this is my julia.executablePath in :CocConfig file

"julia.executablePath": "/usr/local/bin/julia",

And I found the following json configuration of coc.nvim can make Julia server work for me (without coc-julia)

{
    "languageserver": {
        "julia": {
            "command": "julia",
            "args" : ["--startup-file=no", "--history-file=no", "-e",
            "using LanguageServer;\n       using Pkg;\n       import StaticLint;\n       import SymbolServer;\n       env_path = dirname(Pkg.Types.Context().env.project_file);\n       server = LanguageServer.LanguageServerInstance(stdin, stdout, env_path, \"\");\n       server.runlinter = true;\n       run(server);" ],
            "filetypes": ["julia"]
        }
    },
}

Deeperand avatar Oct 17 '23 16:10 Deeperand

Got exactly the same issue, with very similar setup.

Julia Version 1.10.0
Commit 3120989f39b (2023-12-25 18:01 UTC)
Build Info:
  Official https://julialang.org/ release
Platform Info:
  OS: Linux (x86_64-linux-gnu)
  CPU: 20 × 13th Gen Intel(R) Core(TM) i7-13800H
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-15.0.7 (ORCJIT, goldmont)
  Threads: 1 on 20 virtual cores

Here is the output of :CocInfo to help with the issue:

## versions

vim version: NVIM v0.6.1
node version: v18.18.2
coc.nvim version: 0.0.82-d1568d56 2023-09-29 19:43:34 +0800
coc.nvim directory: /home/***/.config/nvim/plugged/coc.nvim
term: alacritty
platform: linux

## Log of coc.nvim

2024-01-25T16:12:07.954 INFO (pid:48380) [plugin] - coc.nvim initialized with node: v18.18.2 after 97
2024-01-25T16:12:07.957 INFO (pid:48380) [services] - LanguageClient julia state change: stopped => starting
2024-01-25T16:12:07.961 INFO (pid:48380) [language-client-index] - Language server "languageserver.julia" started with 48408
2024-01-25T16:12:10.767 INFO (pid:48380) [services] - LanguageClient julia state change: starting => running
2024-01-25T16:12:10.774 INFO (pid:48380) [services] - service languageserver.julia started
2024-01-25T16:12:22.190 INFO (pid:48380) [attach] - receive notification: startCompletion [ {} ]
2024-01-25T16:12:25.672 INFO (pid:48380) [snippets-session] - Jump to final placeholder, cancelling snippet session
2024-01-25T16:13:18.862 INFO (pid:48380) [attach] - receive notification: showInfo []

And in nvim's logs (command: nvim -V10mylog.log test.jl:

...
[coc.nvim] Pending response rejected since connection got disposed
[coc.nvim] Julia Language Server client: couldn't create connection to server.
[coc.nvim]: Unhandled response error -32097 from language server: Pending response rejected since connection got disposed
[coc.nvim] Pending response rejected since connection got disposed
[coc.nvim] Julia Language Server client: couldn't create connection to server.
[coc.nvim] Server julia failed to start: Error: Pending response rejected since connection got disposed
[coc.nvim] Pending response rejected since connection got disposed
[coc.nvim] Julia Language Server client: couldn't create connection to server.
[coc.nvim]: The "julia" server crashed 4 times in the last 3 minutes. The server will not be restarted.
[coc.nvim] Connection to server got closed. Server will not be restarted.
[coc.nvim] Pending response rejected since connection got disposed
[coc.nvim] Julia Language Server client: couldn't create connection to server.
...

floffy-f avatar Jan 25 '24 15:01 floffy-f

You shouldn't use coc-julia with languageserver.julia in coc-settings.jon at the same time.

fannheyward avatar Apr 24 '24 10:04 fannheyward