Coc.nvim: Can't configure vue-language-server

Created on 23 Jul 2018  路  24Comments  路  Source: neoclide/coc.nvim

Hi, I can't make coc to work with vue-language-server
Here the content of my coc-settings.json:

{
    "languageserver" : {
        "vue": {
            "command": "vls",
            "filetypes": ["vue"]
        }
    }
}
$ which vls 
 /usr/bin/vls



md5-29690a92f758aacff78109bafae8b669



$ nvim -v
NVIM v0.3.1



md5-83d899b93daff41c9161443ce5bb96c7



[coc.nvim] Executable vls not found                                                                                                                                                            
[coc.nvim] Service init error: Cannot read property 'catch' of undefined                                                                                                                       
[coc.nvim] service stylelint started                                                                                                                                                           
Press ENTER or type command to continue                                                                                                                                                        

Thank you for your work and help.

EDIT: vls works fine with deoplete and https://github.com/autozimu/LanguageClient-neovim

bug

Most helpful comment

I'm going to add vetur to extensions, it's easier for configuration while have same features as in VSCode.

All 24 comments

@deathmaz What the result when you run :echo executable('vls') in vim?

Looks like vls can't be found on $PATH, you can change command to /usr/bin/vls

:echo executable('vls') return 1
I already tried before /usr/bin/vls as an argument for command the result is the same as previous

I'm looking into it.

I can fix this, but vls read some configuration from unknown variable.

It's reading configuration from initializationOptions.config which is not standard and it's not checking the existence of variable.

@deathmaz You need this

    "vue": {
      "command": "vls",
      "args": [],
      "settings": {
        "html": {
          "suggest": true
        },
        "vetur": {
          "validation": {}
        }
      },
      "filetypes": ["vue"],
      "initializationOptions": {
        "config": {
          "html": {
            "suggest": true
          },
          "vetur": {
            "validation": {}
          }
        }
      }
    }

in languageserver section for vls to work.

is it intended that after i opened .vue file nvim opens vertical split with the following content

Vetur initialized
[Error - 12:58:51 PM] Notification handler 'workspace/didChangeConfiguration' failed with message: Cannot read property 'vetur' of undefined

?

though the vls itself seems works fine

@deathmaz That's another issue, I have update the configuration.

Now you can use

    "vue": {
      "command": "vls",
      "args": [],
      "configSection": "languageserver.vue.initializationOptions.config",
      "filetypes": ["vue"],
      "initializationOptions": {
        "config": {
          "html": {
            "suggest": true
          },
          "vetur": {
            "validation": {}
          }
        }
      }
    }

for vls, it's reading configuration from wired position.

Make sure to upgrade to latest master to have this feature.

Hm, i still have the same error

Run git pull and then yarn install, restart neovim should be fine.

I should provide a vim command for user to upgrade coc.

i'm using vim-plug, so :PlugUpdate works fine

The issue has gone, everything woks fine. Thank you very much for the help! Btw autocompletion in you plugin works super fast compared to what i had in deoplete.

it still doesn't work for me

image

coc-settings.json:

{
    "languageserver": {
        "sh": {
            "command": "bash-language-server",
            "args": ["start", "--stdio"],
            "filetypes": ["sh"],
            "cwd": "./",
            "initializationOptions": {},
            "settings": {}
        },
        "dart": {
            "command": "dart_language_server",
            "args": [],
            "filetypes": ["dart"],
            "cwd": "./lib",
            "initializationOptions": {},
            "settings": {}
        },
        "vue": {
            "command": "vls",
            "args": [],
            "configSection": "languageserver.vue.initializationOptions.config",
            "filetypes": ["vue"],
            "initializationOptions": {
                "config": {
                    "html": {
                        "suggest": true
                    },
                    "vetur": {
                        "validation": {}
                    }
                }
            }
        }
    }
}
// vim:ft=jsonc

@iamcco add "completion:{}" below validation should do the trick.

You can have full configuration here https://github.com/vuejs/vetur/blob/master/package.json#L131

it works well now, thanks

I'm going to add vetur to extensions, it's easier for configuration while have same features as in VSCode.

i update to latest master and it seems that the vetur extensions doesn't work for me.

when i edit the test.vue file the cpu raise to 100%.

2018-07-23 9 18 59

2018-07-23 9 19 37

@iamcco have you installed watchman?

i had installed watchman and it works well if the work directory is not the home directory.

It get sucks when there're too many files in the directory, I have exclude watching for home on my side.

@chemzqm get it, thanks

Was this page helpful?
0 / 5 - 0 ratings

Related issues

lanox picture lanox  路  3Comments

cvlmtg picture cvlmtg  路  3Comments

rkulla picture rkulla  路  3Comments

skylite21 picture skylite21  路  3Comments

czepluch picture czepluch  路  3Comments