Coder Social home page Coder Social logo

Adding custom libraries about neodev.nvim HOT 11 CLOSED

folke avatar folke commented on June 28, 2024
Adding custom libraries

from neodev.nvim.

Comments (11)

ranjithshegde avatar ranjithshegde commented on June 28, 2024 1

Thanks. That works.

Either way, please just check the docs for lua-language server. You can change whatever you want on the condig returned by lua-dev.

Only recently setting up sumneko. Still learning. Thank you for your help and patience.

from neodev.nvim.

ranjithshegde avatar ranjithshegde commented on June 28, 2024

@folke
I just tried your gist article which preceded this plugin. Putting the desired paths in that setup's add("/usr/lib/pd/extra/pdlua")
works perfectly
Is there anything that I am doing syntactically wrong in what in my previous post

from neodev.nvim.

folke avatar folke commented on June 28, 2024

Update to the latest version and do something like:

local lspconfig = require('lspconfig')

local luadev = require("lua-dev").setup({
  -- add any options here, or leave empty to use the default settings
  -- lspconfig = {
  --   cmd = {"lua-language-server"}
  -- },
})

table.insert(luadev.settings.Lua.workspace.library, "/usr/lib/pd/extra/pdlua")

lspconfig.sumneko_lua.setup(luadev)

from neodev.nvim.

ranjithshegde avatar ranjithshegde commented on June 28, 2024

Thanks for your response and the qucik change! appreciate it

I get the following error

E5100: Cannot convert given lua table: table should either have a sequence of positive integer keys or contain only string keys
Error executing vim.schedule lua callback: /usr/share/nvim/runtime/lua/vim/lsp/rpc.lua:399: error converting argument 1

from neodev.nvim.

folke avatar folke commented on June 28, 2024

Sorry, should be:

luadev.settings.Lua.workspace.library["/usr/lib/pd/extra/pdlua"] = true

Either way, please just check the docs for lua-language server. You can change whatever you want on the condig returned by lua-dev.

from neodev.nvim.

mehalter avatar mehalter commented on June 28, 2024

Is there a way to do this with the current state of Neodev? It would be great if there was an option in the setup function to add more library folders to include when setting up the library. Not sure if there is a way to do it with the override function. I can see that I can modify the setup options there like enable/disable the library or plugins, but is there a way to add a specific folder to the workspace library list?

from neodev.nvim.

folke avatar folke commented on June 28, 2024

You should just add any custom libraries to the settings for lspconfig. No need to change anything in Neodev for that

from neodev.nvim.

mehalter avatar mehalter commented on June 28, 2024

Thanks for the quick reply, I am doing that currently but I am wondering if neodev provides an easy way to only add the library when neodev is active. Since it's a folder in my Neovim runtime path but it's not getting access to variables defined in my ~/.config/nvim folder

from neodev.nvim.

mehalter avatar mehalter commented on June 28, 2024

I'm not sure if Neodev should be giving access to these things automatically when it sets up the lbrary runtime path. I can see the folder in my runtime path and Neodev is correctly enabling the runtime so I can get auto complete for vim types as well as plugins, but it's not properly adding the other folders in the runtime path as part of the library. So I can't get auto complete for the other variables that I have defined in other runtime path folders. So in this case I want it to automatically add runtime path folders to the workspace library and only when neodev has detected that it should be enabled. So adding it to my global lspconfig settings for sumneko_lua isn't really an appropriate place since it's only related to my neovim configuration files/folders

Sorry I'm continuing this on this issue, I just didn't want to open a new issue if it was related to this one and decrease clutter on the repo. It seems like if it's not supposed to be automatically detected, I would want to be able to add it to the override function to include my config folder and other runtime path folders.

from neodev.nvim.

mehalter avatar mehalter commented on June 28, 2024

I have ~/.config/separate_folder in my RTP and investigating the workspace settings that are set with vim.lsp.get_active_client() I see that it's correctly adding the neodev stable types, my user/share/nvim/runtime/lua and ~/.config/separate_folder/lua but it's not adding ~/.config/nvim/lua which is still in my RTP and should be getting checked

workspace = {                                                                                                           
  checkThirdParty = false,                                                                                              
  ignoreDir = { "types/nightly", "lua" },                                                                               
  library = { "/home/micah/.local/share/nvim/lazy/neodev.nvim/types/stable", "/usr/share/nvim/runtime/lua", "/home/micah
/.config/separate_folder/lua" }                                                                                                         
}                                                                                                                       

from neodev.nvim.

folke avatar folke commented on June 28, 2024

The config folder is never added to the workspace outside of the config folder, since in most cases (like when developing a plugin) that's not wanted.

If you still need that for a certain folder, then just add it only for that project.

You could use a luarc.json file in that folder, to add in your config as a workspace folder.

from neodev.nvim.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.