Languageclient-neovim: Server won't automatically start using native packages feature and jsx filetype

Created on 29 Oct 2018  路  6Comments  路  Source: autozimu/LanguageClient-neovim

  • Did you upgrade to latest plugin version?
    Yes
  • Did you upgrade to/compile latest binary?
    Yes, languageclient 0.1.124
  • (Neovim users only) Did you check output of :checkhealth LanguageClient?
health#LanguageClient#check
========================================================================
  - OK: binary found: /home/kristijan/.config/nvim/pack/packager/start/LanguageClient-neovim/bin/languageclient
  - OK: languageclient 0.1.124 
  • Did you check [troubleshooting]?
    Yes, nothing there.

Describe the bug

Language server is not started for jsx filetypes automatically. I need to run LanguageClientStart manually each time.

Environment

  • neovim/vim version (nvim --version or vim --version): NVIM v0.3.2-dev
  • This plugin version (git rev-parse --short HEAD): b7fcc7e
  • This plugin's binary version (bin/languageclient --version): wrote above
  • Minimal vimrc content (A minimal vimrc is the smallest vimrc that could
    reproduce the issue. Refer to an example [here][min-vimrc.vim]):

Install steps:

  1. git clone https://github.com/autozimu/LanguageClient-neovim ~/.config/nvim/pack/packager/start/LanguageClient-neovim
  2. cd ~/.config/nvim/pack/packager/start/LanguageClient-neovim && bash install.sh
  3. git clone https://github.com/mxw/vim-jsx ~/.config/nvim/pack/packager/start/vim-jsx
  4. npm install -g javascript-typescript-langserver
" minimum init.vim
" packages loaded automatically from pack folder
let g:LanguageClient_serverCommands = {
\ 'javascript': ['javascript-typescript-stdio'],
\ 'javascript.jsx': ['javascript-typescript-stdio'],
\ }

To Reproduce

Steps to reproduce the behavior:

  1. Create folder my-js-project and cd into it
  2. create file index.jsx with this content:
import { Join } from './included';

const MyComponent = () => (
  <div>{Join('test', 'testing')}</div>
)

export default MyComponent;
  1. crate file included.jsx with this content:
export const Join = (a ,b) => [a, b].join(' ');
  1. Start neovim, open index.jsx, go to Join with cursor
  2. execute :call LanguageClient#textDocument_definition()

Current behavior

I get error Language server is not running for: javascript.jsx

Expected behavior

Should jump to the first line to Join

Additional context

issue is fixed either by adding packadd vim-jsx to the init.vim at the beginning, or starting the server manually.

I think that general issue is that vim-jsx plugin is an "after" plugin, and it's autocmd to set the filetype is done after the languageclient init. This shouldn't be an issue.

Most helpful comment

Unfortunately this change broke everything for me. None of the language servers starts automatically, even for the things that worked before (python, go, regular js). Here's my server commands:

let g:LanguageClient_serverCommands = {
\ 'javascript': ['javascript-typescript-stdio'],
\ 'javascript.jsx': ['javascript-typescript-stdio'],
\ 'typescript': ['javascript-typescript-stdio'],
\ 'go': ['go-langserver', '-gocodecompletion', '-func-snippet-enabled=false'],
\ 'python': ['pyls'],
\ }

I noticed that autocmd FileType is not firing for me at all, until i do filetype detect. But that still doesn't start the server.

I know that vim-plug does some manual triggering of filetype detection, and that why it works with it.
Also the solution by adding packadd that i mentioned above is also not working.

I did some research and found this issue on neovim https://github.com/neovim/neovim/issues/4684

I tried both suggestions from this comment https://github.com/neovim/neovim/issues/4684#issuecomment-273124331 , but none of them work.

All 6 comments

Thanks for reporting.

Unfortunately this change broke everything for me. None of the language servers starts automatically, even for the things that worked before (python, go, regular js). Here's my server commands:

let g:LanguageClient_serverCommands = {
\ 'javascript': ['javascript-typescript-stdio'],
\ 'javascript.jsx': ['javascript-typescript-stdio'],
\ 'typescript': ['javascript-typescript-stdio'],
\ 'go': ['go-langserver', '-gocodecompletion', '-func-snippet-enabled=false'],
\ 'python': ['pyls'],
\ }

I noticed that autocmd FileType is not firing for me at all, until i do filetype detect. But that still doesn't start the server.

I know that vim-plug does some manual triggering of filetype detection, and that why it works with it.
Also the solution by adding packadd that i mentioned above is also not working.

I did some research and found this issue on neovim https://github.com/neovim/neovim/issues/4684

I tried both suggestions from this comment https://github.com/neovim/neovim/issues/4684#issuecomment-273124331 , but none of them work.

I have the same issue, but, manually starting the LanguageClient with :LanguageClientStart works.

That's probably caused by a recent change that caused a mismatch between binary side and vimscript side.

Please try out the latest release.

Updated to the latest release and it works now!

Works for me also, thanks!

Was this page helpful?
0 / 5 - 0 ratings