# Use LanguageServer.jl on vim 8.1 with vim-lsp plugin

**URL:** <https://discourse.julialang.org/t/use-languageserver-jl-on-vim-8-1-with-vim-lsp-plugin/20601>\
**Category:** Tooling\
**Tags:** editors\
**Created:** [February 9, 2019, 5:33am UTC](https://discourse.julialang.org/t/use-languageserver-jl-on-vim-8-1-with-vim-lsp-plugin/20601 "2019-02-09T05:33:07Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![machakann](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/machakann/32/3914_2.png) [@machakann](https://discourse.julialang.org/u/machakann)\
**Post date:** [February 9, 2019, 5:33am UTC](https://discourse.julialang.org/t/use-languageserver-jl-on-vim-8-1-with-vim-lsp-plugin/20601/1 "2019-02-09T05:33:07Z")

</div>

Hi all, right now I succeed to use [LanguageServer.jl](https://github.com/JuliaEditorSupport/LanguageServer.jl) on vim 8.1 with [vim-lsp plugin](https://github.com/prabirshrestha/vim-lsp); I will describe what I did below. I would be happy if it was helpful for others. Many thanks for the maintainers of LanguageServer.jl, this is definitely a great work.

## Julia side

I could not get it work with v1.1.0, probably we need v1.0.3 currently. It may be solved for the future version.

1. Install julia v1.0.3
2. Open julia v1.0.3 and type `]add LanguageServer SymbolServer`
3. Save the `startlanguageserver.jl` (see below) as a file in your computer

- startlanguageserver.jl

```julia-auto
import LanguageServer
import Pkg
import SymbolServer

envpath = dirname(Pkg.Types.Context().env.project_file)

const DEPOT_DIR_NAME = ".julia"
depotpath = if Sys.iswindows()
    joinpath(ENV["USERPROFILE"], DEPOT_DIR_NAME)
else
    joinpath(ENV["HOME"], DEPOT_DIR_NAME)
end

server = LanguageServer.LanguageServerInstance(stdin, stdout, false, envpath, depotpath, Dict())
server.runlinter = true
run(server)

```

## Vim side

Install `vim-lsp` and its requirements.

```julia-auto
Plug 'prabirshrestha/async.vim'
Plug 'prabirshrestha/vim-lsp'

```

Cited from the README of `vim-lsp`, please use your favorite plugin manager. If you want autocompletion, add some requirements.

```julia-auto
Plug 'prabirshrestha/asyncomplete.vim'
Plug 'prabirshrestha/async.vim'
Plug 'prabirshrestha/vim-lsp'
Plug 'prabirshrestha/asyncomplete-lsp.vim'

```

Write the lines below into your vimrc. You need to arrange the path to the executable and the script; `s:julia_exe` and `s:julia_lsp_startscript`.

- vimrc

```julia-auto
let s:julia_exe = 'path/to/julia-1.0.3-executable'
let s:julia_lsp_startscript = 'path/to/startlanguageserver.jl'
if executable('julia')
  autocmd User lsp_setup call lsp#register_server({
  \ 'name': 'julia',
  \ 'cmd': {server_info->[s:julia_exe, '--startup-file=no', '--history-file=no', s:julia_lsp_startscript]},
  \ 'whitelist': ['julia'],
  \ })
endif

```

FYI, I’m using windows 10 and vim 8.1.878.

---

<div class="post-metadata">

**Author:** ![AtsushiSakai](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/atsushisakai/32/6559_2.png) [@AtsushiSakai](https://discourse.julialang.org/u/AtsushiSakai)\
**Post date:** [February 9, 2019, 8:41am UTC](https://discourse.julialang.org/t/use-languageserver-jl-on-vim-8-1-with-vim-lsp-plugin/20601/2 "2019-02-09T08:41:56Z")

</div>

@machakann Thank you for great info!!. I tried it, however it doesn’t work…  
When I command “:LspStatus”, It is shown that the julia server is “exited”.

Could you please let me know your versions of LanguageServer.jl and SymbolServer.jl?

Perferps, my OS could be related. I’m using Mac OS.

---

<div class="post-metadata">

**Author:** ![machakann](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/machakann/32/3914_2.png) [@machakann](https://discourse.julialang.org/u/machakann)\
**Post date:** [February 9, 2019, 2:41pm UTC](https://discourse.julialang.org/t/use-languageserver-jl-on-vim-8-1-with-vim-lsp-plugin/20601/3 "2019-02-09T14:41:36Z")

</div>

@AtsushiSakai I’m using LanguageServer.jl v"0.5.1" and SymbolServer.jl v"0.1.2".

I’m not sure why it exited. If you can use vim-lsp, try `let g:lsp_log_file = 'lsp.log'` and open a julia file. It will emit logs to the file `lsp.log`. It might help you to check what happened. If you can post or upload the logs, I may be able to help you but the log file may include your texts, paths and something personal. Be careful.

---

<div class="post-metadata">

**Author:** ![AtsushiSakai](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/atsushisakai/32/6559_2.png) [@AtsushiSakai](https://discourse.julialang.org/u/AtsushiSakai)\
**Post date:** [February 10, 2019, 12:47am UTC](https://discourse.julialang.org/t/use-languageserver-jl-on-vim-8-1-with-vim-lsp-plugin/20601/4 "2019-02-10T00:47:39Z")

</div>

@machakann It works!! Thank you. My LangulageServer was old.  
Thank you for great info.
