josa42 / coc-lua

Lua language server extension using lua-lsp for coc.nvim.
MIT License
133 stars 5 forks source link

How to append `vim.api.nvim_get_runtime_file('', true)` to Lua.workspace.library? #100

Open FalcoGer opened 10 months ago

FalcoGer commented 10 months ago

I don't want to manually adjust my workspace library whenever I install or remove a plugin. Luckily vim.api.nvim_get_runtime_file('', true) produces all the paths that nvim's lua interpreter looks for libraries for. Unfortunately the settings in the coc-configurations are done with a json file and there is no syntax to do a function call there to populate any options, as far as I could gather. Is there some way to put all those paths into Lua.workspace.library in a different way? Maybe some special string?

jakubfijalkowski commented 7 months ago

From what I found, you can leverage coc#config to change the configuration at runtime (or use g:coc_user_config). This works for me:

vim.cmd([[
  autocmd FileType lua call coc#config('Lua.workspace.library', nvim_get_runtime_file('', 1))
]])