Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sumneko needs a meta folder to support builtins #694

Open
idbrii opened this issue Aug 10, 2023 · 0 comments
Open

sumneko needs a meta folder to support builtins #694

idbrii opened this issue Aug 10, 2023 · 0 comments

Comments

@idbrii
Copy link
Contributor

idbrii commented Aug 10, 2023

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 LuaLS/lua-language-server#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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant