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

Server status: not started #91

Closed
GCorbel opened this issue Jun 4, 2018 · 14 comments
Closed

Server status: not started #91

GCorbel opened this issue Jun 4, 2018 · 14 comments

Comments

@GCorbel
Copy link

GCorbel commented Jun 4, 2018

Hello,

I tried to use vim-lsc with ruby and javascript files and I always have the message "Server status: not started".

I have this config lines for vim-lsc :

let g:lsc_auto_map = v:true
let g:lsc_enable_autocomplete = v:true
let g:lsc_server_commands = {'ruby': 'solargraph socket', 'javascript': 'node /tmp/javascript-typescript-langserver/lib/language-server'}
let g:lsc_auto_map = {
    \ 'GoToDefinition': '<C-]>',
    \ 'FindReferences': 'gr',
    \ 'NextReference': '<C-n>',
    \ 'PreviousReference': '<C-p>',
    \ 'FindImplementations': 'gI',
    \ 'FindCodeActions': 'ga',
    \ 'DocumentSymbol': 'go',
    \ 'WorkspaceSymbol': 'gS',
    \ 'ShowHover': 'K',
    \ 'Completion': 'completefunc',
    \}

I try with this file :

class Blabla
  def test
  end
end

blabla = Blabla.new
blabla.test

I have the error message when I go to blabla.[test] on the last line and I do gr.

The server is running because I have some results when I do ps aux | grep solargraph. Solargraph is launched when I go on Ruby file.

I have the exact same with Javascript files.

Do I have something more to do?

@natebosch
Copy link
Owner

It sounds like the server might not be responding to the initialize call, or the client might be failing to understand it. I'll need to get some subset of #19 implemented to make it easier to diagnose what might be happening.

In the mean time if you'd like to attempt to get a communication log you could try following https://github.com/natebosch/vim-lsc/wiki/Server-Debugging-Tips#logging-communication-across-stdio

@GCorbel
Copy link
Author

GCorbel commented Jun 4, 2018

Here is my in.log :

Content-Length: 374

{"method":"initialize","jsonrpc":"2.0","id":1,"params":{"rootUri":"file:///workspace/ my-project","capabilities":{"workspace":{"applyEdit":true},"textDocument":{"completion":{"snippetSupport":false},"synchronization":{"willSaveWaitUntil":false,"willSave":false,"didSave":false},"definition":{"dynamicRegistration":false}}},"processId":25759,"trace":"verbose"}}

And the out.log is exactly the same.

@GCorbel
Copy link
Author

GCorbel commented Jun 4, 2018

Sorry, there is nothing in out.log

@GCorbel
Copy link
Author

GCorbel commented Jun 4, 2018

When I start vim I have this message [lsc:Error] StdErr from solargraph socket: Solargraph is listening PORT=7658 PID=21759. It starts, solargraph but it gives an error.

@GCorbel
Copy link
Author

GCorbel commented Jun 5, 2018

With a JS file, I have :

DEBUG Spawning 4 workers
DEBUG Worker 1 (PID 27624) online
DEBUG Worker 3 (PID 27635) online
DEBUG Worker 2 (PID 27629) online
DEBUG Worker 4 (PID 27641) online
INFO  Listening for incoming LSP connections on 2089
INFO  Listening for incoming LSP connections on 2089
INFO  Listening for incoming LSP connections on 2089
INFO  Listening for incoming LSP connections on 2089

I still have the error even if the server seems to be correctly started.

@natebosch
Copy link
Owner

Solargraph is listening PORT=7658

Ah - that's the issue. vim-lsc by default expects to communicate over stdio (that's typical for most language servers but it looks like solargraph doesn't support it). To work over a socket we need a different configuration.

What you might need to do is start solargraph in a separate terminal, and configure your server in vim-lsc to be 'localhost:7658', or if you are using nvim 'nc localhost:7658' (#83 would improve the nvim config)

Hopefully that port number is stable...

This workflow isn't ideal, but I'm not sure how feasible it would be to solve it. I filed #92 to track but I'm not expecting to be able to solve it anytime soon.

@GCorbel
Copy link
Author

GCorbel commented Jun 5, 2018

It's a little bit better but I have another error :

Error detected while processing function <SNR>85_OnOpen[4]..lsc#file#onOpen[1]..lsc#server#start[3]..<SNR>100_Start[30]
..lsc#server#call[14]..276[3]..321[2]..322[2]..323:
line    1:
E906: not an open channel

@GCorbel
Copy link
Author

GCorbel commented Jun 5, 2018

With Javascript, I use javascript-typescript-langserver and I have this error on the node server side :

/tmp/javascript-typescript-langserver/lib/util.js:46
    const pathParts = parts.pathname.split('/').map(segment => encodeURIComponent(decodeURIComponent(segment)));
                                                                                  ^

URIError: URI malformed
    at decodeURIComponent (<anonymous>)
    at parts.pathname.split.map.segment (/tmp/javascript-typescript-langserver/lib/util.js:46:83)
    at Array.map (<anonymous>)
    at Object.normalizeUri (/tmp/javascript-typescript-langserver/lib/util.js:46:49)
    at Glob.globber.on (/tmp/javascript-typescript-langserver/lib/fs.js:62:40)
    at Glob.emit (events.js:180:13)
    at Glob._emitMatch (/tmp/javascript-typescript-langserver/node_modules/glob/glob.js:489:8)
    at Glob._processSimple2 (/tmp/javascript-typescript-langserver/node_modules/glob/glob.js:705:8)
    at /tmp/javascript-typescript-langserver/node_modules/glob/glob.js:676:10
    at Glob._stat2 (/tmp/javascript-typescript-langserver/node_modules/glob/glob.js:789:10)
ERROR Worker 3 (PID 10951) exited from signal null with code 1, restarting

So it seems than the URL used is malformed.

@natebosch
Copy link
Owner

We're getting closer 😄

I did notice this in the original logs: "rootUri":"file:///workspace/ my-project" which could explain this error. Does the directory have a space in it?

We do attempt to URI encode paths which should have replaced that space with something else:

return s:filePrefix().s:EncodePath(file_path)

I'm not quite sure what might be happening there...

@GCorbel
Copy link
Author

GCorbel commented Jun 5, 2018

Sorry, this is a typo when I changed the path manually (To remove the project I'm working for). There is no space in the real path.

@natebosch
Copy link
Owner

Does the URI look correct to you in the real logs? Anything odd in terms of special characters?

@GCorbel
Copy link
Author

GCorbel commented Jun 5, 2018

I got it! I added a console.log in the lib/utils.js of javascript-typescript-langserver and I have this which is parsed and make the script crash :

tmp/bundle/gems/railties-4.2.7.1/lib/rails/generators/rails/generator/templates/%file_name%_generator.rb.tt

So this is not related to vim-lsc. I don't know if it's the same reason for solargraph.

@GCorbel
Copy link
Author

GCorbel commented Jun 5, 2018

Surprisingly, it seems to works with solargraph (with the host and port). I will try the rest of the day to be sure.

@GCorbel
Copy link
Author

GCorbel commented Jun 8, 2018

I close this issue because it works in vim-lsc. Maybe you should add a note about stdio and sockets.

@GCorbel GCorbel closed this as completed Jun 8, 2018
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

2 participants