I’ve just tried to get this working, and I can successfully run the language server (from the log "[ Info: Received new data from Julia Symbol Server.\n"), but when using autocomplete inside of nvim it constantly says Missing Reference: ... next to the cursor when I’m typing and I don’t see any lsp suggestions in the autocomplete dropdown.
I’m running NVIM v0.5.0-584-gf137307dc. I tried my previous config, using the basic nvim config @kdheepak provided in the post above, and the aforementioned config with the additional packages deoplete and deoplete-lsp. I made sure to clear old plugins and cache files before trying this.
I also notice high CPU usage from the Julia process that runs when a .jl file is opened (note that this is after the first run where the packages are indexed), is that expected?
Does anyone have any suggestions to get this working?
Edit: It seems to show some lsp autocomplete suggestions when I’m editing a new file, but when editing an existing .jl file with a good bit of code in it I get the Missing Reference: ....
If you are getting “Missing Reference: …” then LSP is working for you. Diagnostics may show missing references if LanguageServer.jl is not able to find those references. This may happen for a number of reasons. For example LanguageServer.jl will only find references in the src folder of a package, and will not find references in the tests folder. This may also be affected by whether or not you have a Manifest.toml file in the folder. See @ExpandingMan’s LSPNeovim.jl package for more information on this.
If you want to decrease the verbosity of the diagnostic messages, you can use something like diagnostic-nvim. See @ExpandingMan’s dotfiles for an example of configuring neovim using nvim-lsp, diagnostic-nvim and deoplete and deoplete-lsp. Make sure you are using the latest versions of deoplete and deoplete-lsp.
I’m not sure why autocomplete isn’t working for you properly. If you are not wedded to deoplete, you can also try completion-nvim. You can see my dotfiles at this commit for an example on how to configure neovim, nvim-lsp, diagnostic-nvim, and completion-nvim.
Here’s the relevant pieces:
Install the plugins
Plug 'nvim-lua/diagnostic-nvim' | " better neovim built in lsp diagnostics
Plug 'nvim-lua/completion-nvim' | " better neovim built in lsp completion
Initialize
autocmd BufEnter * lua require'completion'.on_attach()
lua << EOF
local nvim_lsp = require'nvim_lsp'
local on_attach_vim = function()
require'diagnostic'.on_attach()
end
nvim_lsp.julials.setup({on_attach=on_attach_vim})
EOF
Configure
let g:diagnostic_auto_popup_while_jump = 0
let g:diagnostic_enable_virtual_text = 0
let g:diagnostic_enable_underline = 0
let g:completion_timer_cycle = 200 "default value is 80
really hate how lsp eco system is fragmented so thanks for having pointers here. Since I write more julia than python now I decided to abandon the deoplete and jump to your band wagon:
still several questions (I use vim as a tool so not really know about the internals):
when I ‘fix’ 1, I still don’t get completion prompt, and when I manually :call LanguageClient_textDocument_hover() I get a send to disconnected channel
I’m not using LanguageClient-neovim, I’m using the built-in LSP. It seems like currently there are four approaches: You can use LanguageClient-neovim, SpaceVim, deoplete or completion-nvim.
Thanks for the tips! Are the indices supposed to be cached somewhere? If I open a Julia file that is not associated with a particular Project, the LS re-indexes every single package in my global Project.toml and it’s taking a lot of CPU each time.
Hi thanks for the thread. I’ve followed the instructions and ended up setting everything up.
However, I have a personal package that I use, which are just collections of functions at some home directory. I don’t have an actual project.toml files or anything like that. Stuff like src set up etc. since I am not familiar with how to properly develop packages.
However, I think that is leading to having missing reference error show up when I import that package.
For example, if I just have some package called A and have “using A”, that A shows up as missing reference.
Is there any way to tell Julia to get rid of this error message? I am already using diagonstic-nvim but that didn’t seem to help, unless I messed something up.
Secondly, suppose I have some named tuple called B that consists of a and b. If I type B. in the .jl file and press tab, nothing shows up. B is defined in the REPL (and ofc works in REPL). I do not have other external autocompletion plugin. Is there any way to get tab completion working for named tuples without an additional plugin like deoplete? I prefer not to use other external plugins at the moment because I use a lot of greek letters which uses tabs.
Hey, I have LanguageServer installed both globally and in my Project. nvim-lsp is working, but it cannot find the packages installed in the Project. Neovim working dir is the root of the project
Hello, can you try to read the log? :JuliaFormatterLog does the trick.
Also, with the latest version, :JuliaFormatterEchoCmd on the first call shows the command used for launching the server. Just copy it and launch in a different terminal. If it fails, feel free to put here the error output…
With the latest version of JuliaFormatter.vim you can use :JuliaFormatterEchoCmd to get the command that is being executed. There’s also :JuliaFormatterLog that shows you the log from the server that can help for debugging purposes. This of course is not related to LSP.
Thanks for the tip with JuliaFormatterLog. Very useful. The juliaformatter actually works. It’s my neovim native lsp via nvim-lspconfig that doesn’t work. But I have no idea why. I just get a stackoverflow error from my ~/.cach/nvim/lsp.log file. Weird because when I run the same commands in julia on my own it works. Maybe I’ll just post it on neovim to see if those guys knows what’s going on. I’m sure I’m doing something stupid.