Open uforic opened 7 years ago
Hey matt:
filetype
as the key for the files right now. You could use autocommands when entering those files to set it to a certain filetype, or we could use some backup for that. Alternatively, we could specify a list of filetypes that correspond to one server. I'll let you know what I figure out.:lnext
or :cnext
depending on the request to move through the location list or quickfix list. That will scroll them live. It would be uncommon to move your cursor on them and expect to got there immediately I think.How does this look?
let g:langserver_executables = {
\ 'go': {
\ 'name': 'sourcegraph/langserver-go',
\ 'cmd': ['langserver-go', '-trace', '-logfile', expand('~/Desktop/langserver-go.log')],
\ },
\ 'python': {
\ 'name': 'sourcegraph/python-langserver',
\ 'cmd': [expand('~/bin/python-langserver/python-langserver.py')],
\ },
\ 'javascript,typescript,jsx,tsx': {
\ 'name': 'javascript-typescript',
\ 'cmd': [],
\ },
\ }
Re: 3 Sick - so in this case, both would work? Could I also specify js,jsx, instead of javascript,jsx? Re: 2: Trying against the go-langserver - and I'm running the `langserver#symbol#workspace#request("NewHandler") as an example - odd! 4: Didn't know that trick - that worked like a charm. Thx!
In reference to the filetype, I'm using vim's built-in filetype system to manage these. So you would still say 'javascript'. You can see what type a file is by doing :echo &filetype
when you are in the file. You can read more about it with :help 'filetype'
. I think it would not be considered idiomatic vim to use js
instead of javascript
. The same way you wouldn't want to have to put py
for python files, you'd want to say python
.
I will look into that same symbol request and see what happens for me.
Also, did you see my message about the fs/readFile
command? I think I got it working as I was able to run the python langserver without modification. :D
@tjdevries there was a bug in my vim-lsp
response parser. I have fixed and tested it to work with both go and typescript lsp servers. Also it is now capable of handling server instantiated responses like fs/readFile
https://github.com/prabirshrestha/vim-lsp/pull/2
I was able to get pure vim-lsp
working with typescript. Posted the sample at https://github.com/prabirshrestha/vim-lsp/issues/3#issue-197453543
If you do not pass -s
(strict mode) options you will get fs/readFile
notification which is non standard.
'cmd': ['node', '/home/username/tmp/javascript-typescript-langserver/build/language-server-stdio', '-s']
Should we support passing custom on_notifications
so notifications like fs/readFile
can be handled outside the core?
let g:langserver_executables = {
\ 'javascript,typescript,jsx,tsx': {
\ 'name': 'javascript-typescript',
\ 'cmd': ['node', '/home/username/tmp/javascript-typescript-langserver/build/language-server-stdio', '-s'],
\ 'on_notification': function('s:on_notification')
\ },
\ }
Looking great! Couple things I came up with:
langserver#symbol#workspace#request("query")
, any thoughts?I tried the following to set up the JS/TS server: https://cl.ly/2q1H2T2i0I3j
I think that there is some Vim command to grab the extension, and it might be failing to come up with the extension for a language it doesn't support (I haven't configured Vim for TSX yet) - I tried for "js", and it mentioned that there was no supported langserver for "javascript". When I mapped it to "javascript," on a JS file it worked! So I guess the question here is: do we want to map by extensions or by language name / Vim's ability to recognize the language from a file.