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

Document how to let the lua LSP find local libraries, such as plenary #6

Open
Murderlon opened this issue May 12, 2023 · 5 comments
Open

Comments

@Murderlon
Copy link

This template is great, it saved a lot of time.

There is just one thing I don't understand, which is how to make lua_ls (language server for lua) understand where to find the code for plenary. By default plenary is put into /tmp.

I tried to create a .luarc.json to find it but I failed:

{
  "$schema": "https://raw.githubusercontent.com/sumneko/vscode-lua/master/setting/schema.json",
  "diagnostics.globals": ["describe", "it"],
  "workspace.library": ["?.lua", "?/init.lua", "/tmp/plenary.nvim/lua/plenary/?.lua"]
}

Since the docs of plenary are so limited and the LSP doesn't know anything about the available methods and imports of plenary, it's quite hard to develop locally.

@ellisonleao
Copy link
Owner

hey @Murderlon thanks for the feedback. I use this plugin which already loads the plugins I have (including plenary) in the workspace. Maybe it can help you

@Murderlon
Copy link
Author

I use LazyVim from folke which includes that plugin. It's great for vim api's, but I'm talking about plenary. It's added by default in this project but the LSP doesn't understand it exists. So it doesn't know which imports exists, which methods and so on. I was hoping we could add a .luarc.json to this project which sets this up.

@ellisonleao
Copy link
Owner

Can you clarify what places are you going to use plenary for this template, please?

@Murderlon
Copy link
Author

When I import plenary in lua/plugin_name.lua the LSP is not aware plenary exists:

Screenshot 2023-05-18 at 11 19 46

When I import plenary in my nvim config the LSP is aware that the plugin exists:

Screenshot 2023-05-18 at 11 18 09

I think it would be nice if this project included either docs or a config file to make the LSP understand where to find plenary in the files setup by this template.

@Redoxahmii
Copy link

Same issue here did you ever find a solution to this?

When I import plenary in lua/plugin_name.lua the LSP is not aware plenary exists:

Screenshot 2023-05-18 at 11 19 46 When I import `plenary` in my nvim config the LSP is aware that the plugin exists: Screenshot 2023-05-18 at 11 18 09 I think it would be nice if this project included either docs or a config file to make the LSP understand where to find plenary in the files setup by this template.

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

3 participants