Dart Completion in Neovim using Language Server Protocol
Apr 19, 2017
1 minute read

In this short and simple tutorial we will add Dart completion to Neovim using Language Server Protocol.

First of all I will suppose that you already have install Neovim and Dart in your machine.

List of programs that we will need:

Step 1. Install dart_language_server

Since we already have Dart installed, we can install dart_language_server with this command:

pub global activate dart_language_server

Add the pub bin directory in your path (.bashrc or .zshrc file) so the server can be run as dart_language_server. Example:

export PATH="$PATH":/home/<your-user-name>/.pub-cache/bin

Step 2. Install LanguageClient-neovim

You can use any plugin manager available in neovim in this case we will use vim-plug.

Plug 'autozimu/LanguageClient-neovim', { 'do': ':UpdateRemotePlugins' }

Add this configuration to your init.vim:

" Required for operations modifying multiple buffers like rename.
set hidden

let g:LanguageClient_serverCommands = {
    \ 'dart': ['dart_language_server'],
    \ }

Step 3. Install nvim-completion-manager

Again we are using vim-plug to install this plugin.

Plug 'roxma/nvim-completion-manager'

Step 4. Have fun

Open a dart file in neovim. Activate LanguageClient-neovim with this command:

:LanguageClientStart

image

You will notice that dart_language_server also gives us error checking, jump to definition functionalities.



comments powered by Disqus