diff --git a/README.md b/README.md index 58dced6..57d13c7 100644 --- a/README.md +++ b/README.md @@ -4,6 +4,12 @@ Shim for the language server protocol developed by Microsoft. The protocol can b ## Configuration +First you need to install a language server. An example of installing one might be: + +```shell +$ go get github.com/sourcegraph/go-langserver/langserver/cmd/langserver-go +``` + You will need to put this somewhere that is sourced on startup. ```vim diff --git a/autoload/langserver/default.vim b/autoload/langserver/default.vim index 404e4ab..f067131 100644 --- a/autoload/langserver/default.vim +++ b/autoload/langserver/default.vim @@ -3,9 +3,19 @@ let s:langserver_executabe = 'langserver-go' "" " Get the default command for starting the server function! langserver#default#cmd() abort + let l:bad_cmd = [-1] + if has_key(g:langserver_executables, &filetype) - return g:langserver_executables[&filetype]['cmd'] + let l:tmp_cmd = g:langserver_executables[&filetype]['cmd'] + + if type(l:tmp_cmd) != type([]) + echoerr 'Make sure your dictionary is structued like: {"filetype": {"cmd": [cmd, list, here]}}' + return l:bad_cmd + endif + + return l:tmp_cmd + return else - return [-1] + return l:bad_cmd endif endfunction diff --git a/doc/langserver.txt b/doc/langserver.txt index 3389b92..4a3f635 100644 --- a/doc/langserver.txt +++ b/doc/langserver.txt @@ -20,7 +20,10 @@ CONFIGURATION *langserver-configuration* Define a dictionary like this in your vimrc. > let g:langserver_executables = { - \ 'go': ['langserver-go', '-trace', '-logfile', expand('~/Desktop/langserver-go.log')], + \ 'go': { + \ 'name': 'sourcegraph/langserver-go', + \ 'cmd': ['langserver-go', '-trace', '-logfile', expand('~/Desktop/langserver-go.log')], + \ }, \ } TODO: Mappings @@ -33,6 +36,11 @@ Begin with calling: > call langserver#start({}) < +or: > + + :LSPStart +> + TODO: Opening a file TODO: Goto definition TODO: Hover