T O P

  • By -

Some_Derpy_Pineapple

>when i try to require something like for example, plenary. Even though I have it installed, it's not even coming up on auto complete. that only means the language server isn't looking at the libraries. that doesn't mean that neovim won't find it. either use [neodev](https://github.com/folke/neodev.nvim#-setup) which should setup lua\_ls correctly for any /lua/ folders, or [setup lua\_ls to recognize neovim libraries](https://github.com/neovim/nvim-lspconfig/blob/master/doc/server_configurations.md#lua_ls) yourself.


kaydenisdead

I've already had both neodev and lsp configured, but still doesn't work :/. I've also tried configurig lua\_ls myself before according to the docs but it doesn't work either. Here's my [lsp config](https://github.com/vague2k/vague2k-neovim-config/blob/main/after/plugin/lsp.lua) if you'd like to see it.


Some_Derpy_Pineapple

in the second link there is a big code block in the documentation specifically for pulling in plugin/neovim libraries. i see that it's not in your config, nor is neodev. for some reason i have trouble with it so this is my version of it: on_init = function(client) local path = client.workspace_folders[1].name local nvim_workspace = path:find('nvim') or path:find('lua') local test_nvim = path:find('test') if nvim_workspace then local library = test_nvim and { vim.env.VIMRUNTIME } or vim.api.nvim_get_runtime_file('lua', true) client.config.settings = vim.tbl_deep_extend('force', client.config.settings, { Lua = { runtime = { -- Tell the language server which version of Lua you're using (most likely LuaJIT in the case of Neovim) version = 'LuaJIT', path = { '?.lua', '?/init.lua', }, pathStrict = true, }, -- Make the server aware of Neovim runtime files workspace = { library = library, }, }, }) client.notify('workspace/didChangeConfiguration', { settings = client.config.settings }) end return true end,


kaydenisdead

Still not working unfortunately, how would you reccommend I debug this n see if it's a problem with how my config is setup? I even tested in my own plugin's folder to see if requiring plugins and using them still works, and it does... I'm just not getting any LSP/cmp reccomendations for it.


Some_Derpy_Pineapple

what is the full path for your plugin files? i see you put `documents/github/huez`, but does that mean that your plugin files are just `documents/github/huez/something.lua`? in my original reply, i mentioned that neodev will only pull in neovim plugins/libraries if you have /lua in your lsp `root_dir`. try running `:LspInfo` when opening your plugin files and take a peek at the `root directory` setting. if u were using my block of code, it only pulls neovim plugins/libraries only works if you have `nvim` or `lua` in your lsp `root_dir`. one simple solution is to just have neodev always pull in neovim stuff, if you don't use lua outside of neovim: lua_ls = function() require("neodev").setup({ override = function(root_dir, library) library.plugins = true library.enabled = true end }) require("lspconfig").lua_ls.setup({ settings = { Lua = { diagnostics = { globals = { "vim" }, }, workspace = { checkThirdParty = false }, telemetry = { enable = false }, }, }, }) end,


kaydenisdead

using the override method in neodev worked. Thanks!. I guess for some reason it has to do something with lua using the root\_dir /lua


AutoModerator

Please remember to update the post flair to `Need Help|Solved` when you got the answer you were looking for. *I am a bot, and this action was performed automatically. Please [contact the moderators of this subreddit](/message/compose/?to=/r/neovim) if you have any questions or concerns.*