NullVoxPopuli / coc-ember

ember-language-server integration with coc, an intellisense / language server engine for (neo)vim
MIT License
32 stars 3 forks source link

ember-language-server is stuck on `[init]` within coc.nvim #333

Closed toh995 closed 2 years ago

toh995 commented 2 years ago

Is this happening for anyone else?

I can't use coc-ember with neovim.

Using neovim, when I open a random .hbs file in my ember project, ember-language-server seems to just be stuck on [init]. i.e. when I use :CocList services within neovim, then I constantly see this:

ember-language-server [init] hbs, html.handlebars, handlebars, typescript, javascript

I followed the instructions for debugging this extension, and noticed I get

2022-01-19T02:36:09.203 INFO (pid:43151) [plugin] - coc.nvim initialized with node: v14.18.3 after 42ms
2022-01-19T02:36:13.868 DEBUG (pid:43151) [workspace] - buffer created 3
2022-01-19T02:36:13.869 INFO (pid:43151) [extension:coc-ember] - isEmberCli true
2022-01-19T02:36:13.869 INFO (pid:43151) [extension:coc-ember] - UELS bin @ /Users/toh995/.config/coc/extensions/node_modules/coc-ember/node_modules/@lifeart/ember-language-server/lib/start-server.js
2022-01-19T02:36:13.872 INFO (pid:43151) [services] - registered service "ember-language-server"

Using console.info() statements, I have determined that the async function seems to be hanging on the await client.onReady(), i.e. that promise is not resolving for some reason. https://github.com/NullVoxPopuli/coc-ember/blob/master/src/index.ts#L95

When I comment out the await client.onReady(), I get a different debug output error:

2022-01-19T02:31:06.033 INFO (pid:42441) [plugin] - coc.nvim initialized with node: v14.18.3 after 68ms
2022-01-19T02:31:16.382 INFO (pid:42441) [extension:coc-ember] - isEmberCli true
2022-01-19T02:31:16.383 INFO (pid:42441) [extension:coc-ember] - UELS bin @ /Users/toh995/.config/coc/extensions/node_modules/coc-ember/node_modules/@lifeart/ember-language-server/lib/start-server.js
2022-01-19T02:31:16.386 INFO (pid:42441) [services] - registered service "ember-language-server"
2022-01-19T02:31:16.386 INFO (pid:42441) [extension:coc-ember] - Configuring LanguageServerClient...
2022-01-19T02:31:16.386 INFO (pid:42441) [extension:coc-ember] - UELS Addons @ /Users/toh995/.config/coc/extensions/node_modules/coc-ember/lib/addons
2022-01-19T02:31:16.388 INFO (pid:42441) [extension:coc-ember] - [
  '/Users/toh995/.config/coc/extensions/node_modules/coc-ember/lib/addons/node_modules/els-a11y-addon',
  '/Users/toh995/.config/coc/extensions/node_modules/coc-ember/lib/addons/node_modules/els-intl-addon'
]
2022-01-19T02:31:16.388 ERROR (pid:42441) [extension:coc-ember] - Error: Command: els.setConfig not found
    at c5.executeCommand (/Users/toh995/.vim/plugged/coc.nvim/build/index.js:239:13273)
    at configureClient (/Users/toh995/.config/coc/extensions/node_modules/coc-ember/lib/index.js:101:17)
    at boot (/Users/toh995/.config/coc/extensions/node_modules/coc-ember/lib/index.js:64:3)
    at processTicksAndRejections (internal/process/task_queues.js:95:5)
    at async Object.activate (/Users/toh995/.config/coc/extensions/node_modules/coc-ember/lib/index.js:42:5)
2022-01-19T02:31:16.389 ERROR (pid:42441) [extensions] - Error on active extension coc-ember: Command: els.setConfig not found Error: Command: els.setConfig not found
    at c5.executeCommand (/Users/toh995/.vim/plugged/coc.nvim/build/index.js:239:13273)
    at configureClient (/Users/toh995/.config/coc/extensions/node_modules/coc-ember/lib/index.js:101:17)                                                                    
    at boot (/Users/toh995/.config/coc/extensions/node_modules/coc-ember/lib/index.js:64:3)
    at processTicksAndRejections (internal/process/task_queues.js:95:5)
    at async Object.activate (/Users/toh995/.config/coc/extensions/node_modules/coc-ember/lib/index.js:42:5)

Note that I am using a very minimal init.vim file for testing purposes, see below:

"map the leader key to comma
let mapleader = ","

"plugins
call plug#begin('~/.vim/plugged')
    Plug 'neoclide/coc.nvim', {'branch': 'release'}
call plug#end()

let g:coc_global_extensions = ['coc-ember']

I have verified that both coc.nvim and coc-ember are up-to-date.

NullVoxPopuli commented 2 years ago

I was unable to reproduce using this config: https://github.com/NullVoxPopuli/coc-ember/blob/master/docs/minimal-config.vim I also added to the README additional reproduction steps: https://github.com/NullVoxPopuli/coc-ember#to-use-local-coc-ember-in-your-nvim

lemme know if that behaves any different

toh995 commented 2 years ago

@NullVoxPopuli Thanks for the response!

I followed the instructions and used the minimal config, but now my :CocList extensions doesn't list coc-ember. So it doesn't work at all.

Could it be different operating systems? I'm using Mac OS X.

NullVoxPopuli commented 2 years ago

oh potentially -- I'm using Linux. I'm not sure where nvim and coc stores its configs -- is it the same place?

:CocList extensions doesn't list coc-ember

:thinking: This is suspicious. when using the minimal config, where does it say your extensions live?

toh995 commented 2 years ago

Hi @NullVoxPopuli sorry for the late response. How can I see where the extensions live? I've been trying to figure it out for the past few hours but having trouble doing so.

toh995 commented 2 years ago

Were you able to reproduce using my minimal vim config that I shared?

NullVoxPopuli commented 2 years ago

How can I see where the extensions live?

:CocList extensions

Were you able to reproduce using my minimal vim config that I shared?

I was not -- with your minimal config, I get proper ember language server integration

toh995 commented 2 years ago

Okay, thanks for the response. :CocList extensions doesn't show coc-ember at all when using your minimal config... It only seems to show up on the :CocList extensions if I include coc-ember within g:coc_global_extensions

NullVoxPopuli commented 2 years ago

Did you run CocUpdate? or :CocInstall?

toh995 commented 2 years ago

Yeah, neither of those work for me on your minimal config.

Going back to my minimal config, :CocList extensions shows me that coc-ember is located in ~/.config/coc/extensions/node_modules/coc-ember

NullVoxPopuli commented 2 years ago

is your neovim up to date?

toh995 commented 2 years ago

I think so, my neovim is on 0.6.1

NullVoxPopuli commented 2 years ago

:thinking: I have 0.7.0-dev -- can you try that one?

toh995 commented 2 years ago

I have a solution now, thanks to @NullVoxPopuli and @andrewheartsxd!

See this comment: https://github.com/NullVoxPopuli/coc-ember/issues/401#issuecomment-1107943114

My solution is to override the filetype set here in vim-ember-hbs: https://github.com/joukevandermaas/vim-ember-hbs/blob/master/ftdetect/handlebars.vim

In my init.vim, I put a line like:

au BufNewFile,BufRead *.handlebars,*.hbs set filetype=handlebars

Now it works for me!