vim-lsp-settings
vim-lsp-settings copied to clipboard
sumneko needs a meta folder to support builtins
I needed to turn off checkThirdParty to get sumneko lua lsp to stop asking me to configure LOVE on each session start. That seems to cause it to fail to load builtins. I found this issue with a solution https://github.com/LuaLS/lua-language-server/issues/1788:
call lsp_settings#set('sumneko-lua-language-server', 'args', ["--metapath", expand('~/.vim-cache/lsp/meta')])
That tells sumneko where it can generate "meta files" that describe modules -- including the built-ins. When it fails to generate these meta files it may fail to recognize some types.
Should vim-lsp-settings include a default meta path? It could be where the server is installed, but I'm not sure if you'd want it to be a default component of args
(since changing args without removing it is unintuitive)?
The default for --metapath is ./meta
so maybe I have something else wrong and somehow that relative path is now rooted somewhere bad?
This is what I'm doing that made builtins (like math.sin
) show as unrecognized:
" In ~/.vim/ftplugin/lua.vim
let servername = 'sumneko-lua-language-server'
if lsp#get_server_status(servername) !=# 'running'
finish
endif
" Prevent love detection nag: lua-language-server#679
" and preload nag: lua-language-server#1594
let cfg = { 'Lua' : {} }
let cfg.Lua.workspace = {
\ 'checkThirdParty' : v:false,
\ 'maxPreload' : 10000,
\ }
call lsp#update_workspace_config(servername, cfg)