My Julia setup for vim with YCM on Linux

Installation

$ pip install jill --user -U
$ jill install 1.3

lsp

Plug 'ycm-core/YouCompleteMe'
Plug 'ycm-core/lsp-examples'
Plug 'JuliaEditorSupport/julia-vim', {'for': 'julia'}

let g:ycm_language_server = [
			\   { 
			\     'name': 'julia',
			\     'filetypes': [ 'julia' ],
			\     'project_root_files': [ 'Project.toml' ],
			\	'cmdline': ['julia', '--startup-file=no', '--history-file=no', '-e', '
			\       using LanguageServer;
			\       using Pkg;
			\       import StaticLint;
			\       import SymbolServer;
			\       env_path = dirname(Pkg.Types.Context().env.project_file);
			\       
			\       server = LanguageServer.LanguageServerInstance(stdin, stdout, env_path, "");
			\       server.runlinter = true;
			\       run(server);
			\   ']
			\  },
			\ ]
$ cd $HOME/.vim/plugged/lsp-examples
$ ./install.py --enable-julia

Ctags and Gtags

# ~/.ctags.d/julia.ctags
--langdef=julia
--langmap=julia:.jl
--regex-julia=/^[ \t]*(([^ \t.({[]+\.)*@[^ \t({[]+[ \t]+)*(function|macro|abstract type|primitive type|struct|mutable struct|module)[ \t]+([^ \t({[]+).*$/\4/f,function/
--regex-julia=/^[ \t]*(([^ \t.({[]+\.)*@[^ \t({[]+[ \t]+)*(([^@#$ \t({[]+)|\(([^@#$ \t({[]+)\))[ \t]*[ \t]*\([^#]*\)([ \t]+where[ \t]+\{.*\})?[ \t]*=([^=].*)?$/\4\5/f,function/
--regex-julia=/^(([^ \t.({[]+\.)*@[^ \t({[]+[ \t]+)*(const[ \t]+)?(([^ \t.({[]+\.)*@[^ \t({[]+[ \t]+)*([^@#$ \t({[]+)[ \t]*=([^=].*)?$/\6/v,variable/

$ ctags -R  --totals=yes --exclude=`.*` --exclude=.git --languages=julia 
$ gtags

jupyter

Plug 'jupyter-vim/jupyter-vim', {'for': ['python', 'julia']}
5 Likes

YouCompleteMe Hover:

GNU global for ref:

Thanks for sharing, @junix

I am trying to get YouCompleteMe in NeoVim to play nice with LanguageServer.jl, but it does not work for me. My log files say that the Julia language server crashes. I tried with Julia 1.7 and (after reading this issue) with 1.6, but to no avail. Different errors pop up, but all involve the JSONRPC package. Could you share the Manifest of your Julia environment that runs language server? I would like to try with the exact same versions.