Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Solargraph connection refused #66

Closed
carlocab opened this issue Nov 18, 2021 · 4 comments
Closed

Solargraph connection refused #66

carlocab opened this issue Nov 18, 2021 · 4 comments

Comments

@carlocab
Copy link

carlocab commented Nov 18, 2021

I'm having trouble getting Solargraph working with coc-solargraph, and would appreciate some help trying to figure this out. Here is the log from CocInfo when opening a blank test.rb:

## versions

vim version: NVIM v0.6.0-dev+594-g36538417f
node version: v17.0.1
coc.nvim version: 0.0.80-03c9add7cd
coc.nvim directory: /Users/carlocab/.config/nvim/plugged/coc.nvim
term: iTerm.app
platform: darwin

## Log of coc.nvim

2021-11-18T16:21:25.934 INFO (pid:41312) [coc-git] - Looking for git in: git
2021-11-18T16:21:25.943 INFO (pid:41312) [services] - registered service "highlight"
2021-11-18T16:21:26.023 INFO (pid:41312) [services] - registered service "solargraph"
2021-11-18T16:21:26.027 INFO (pid:41312) [plugin] - coc.nvim 0.0.80-03c9add7cd initialized with node: v17.0.1 after 297ms
2021-11-18T16:21:26.187 INFO (pid:41312) [extension:coc-solargraph] - Solargraph is listening PORT=49518 PID=41353

2021-11-18T16:21:26.191 ERROR (pid:41312) [language-client-client] - connection error: Error: connect ECONNREFUSED ::1:49518
    at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1161:16) {
  errno: -61,
  code: 'ECONNREFUSED',
  syscall: 'connect',
  address: '::1',
  port: 49518
} undefined
2021-11-18T16:21:26.192 ERROR (pid:41312) [language-client-client] - connection error: Error: connect ECONNREFUSED ::1:49518
    at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1161:16) {
  errno: -61,
  code: 'ECONNREFUSED',
  syscall: 'connect',
  address: '::1',
  port: 49518
} undefined
2021-11-18T16:21:32.675 INFO (pid:41312) [attach] - receive notification: showInfo []

I'm running macOS 12 on an M1 Mac, with Ruby 2.6.8 installed via rbenv. Solargraph was installed with gem, and Neovim and Node were installed via Homebrew.

I have an identical setup on an Intel Mac and it works just fine, so I'm not really sure what I'm doing wrong here. I've pared down my config to just loading coc.nvim and I still see this issue.

@billymonk
Copy link

billymonk commented Nov 23, 2021

@carlocab I was having the same issue with the same setup. I found the following issue: nodejs/node#40702 (comment). Coupled with https://github.com/neoclide/coc-solargraph#transport-options I was able to get it working by adding the following to (my empty) coc-settings.json:

{
  "solargraph.transport": "external",
  "solargraph.externalServer": {
    "host": "127.0.0.1",
    "port": 7658
  }
}

@Flink
Copy link

Flink commented Nov 25, 2021

I have the same problem, had to use the stdio transport to make it work. But if I revert to socket I get the same connection error message.

@carlocab
Copy link
Author

carlocab commented Nov 25, 2021

@billymonk that's really helpful! Thanks for taking the time to help me out here.

Changing my coc-settings.json as you suggested didn't work, but, based on the issue you linked, adding the following line to my init.vim did the trick:

let g:coc_node_args = ['--dns-result-order=ipv4first']

@Flink Thanks for the tip! This worked for me too. That is, instead of setting g:coc_node_args, one can also add

"solargraph.transport": "stdio"

to coc-settings.json.

@billymonk
Copy link

@carlocab I'm glad you got it working. I should have noted (and you may have tried it and it still didn't work), but with my solution above you have to run Solargraph yourself using solargraph socket.

Anyway, I like your answer more since then I don't have to manually start the Solargraph server so I've updated my .vimrc to use your solution.

yous added a commit to yous/dotfiles that referenced this issue Dec 2, 2021
yous added a commit to yous/dotfiles that referenced this issue Dec 21, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants