Skip to content

What values for Lua.runtime.path and Lua.workspace.library? #259

Description

@HiPhish

Hello, Neovim user here.

I want to set the Lua language server up for various types of projects with different settings. My problem right now is that I don't know what values to set for Lua.runtime.path and for Lua.workspace.library.

Let's say I want to write a Lua package, and I want to use dependencies from Luarocks. I somehow need to tell the server where to find my installed rocks. Here is what I have (the configuration is in Lua as well):

Lua = {
	runtime = {
		version = 'Lua 5.3',
		path = {"?.lua", "?/init.lua", "?/?.lua"}
	},
	workspace = {
		library = {
			["/home/hiphish/.luarocks/share/lua/5.3/"] = true,
			["/usr/share/lua/5.3/"] = true,
		}
	},
}

To my understanding this should be right, but I am not getting any completion suggestions for require're (from the lpeg rock). Similarly, if I have local re = require're', I don't get completion suggestions for re.. Do I need to adjust the Lua.runtime.path?

Background: I want to get hard-coded settings right first. The next step would be to programmatically generate these settings. Neovim can be configured in Lua, and the built-in LSP client is essentially a Lua library. I can probe the current directory for specific files (like *.rockspec or init.vim) and generate the appropriate settings on the fly. But to this end I must understand the server settings first.

I hope this explanation makes sense and you can help me understand the settings.

PS: The server cannot load definitions from C modules like lpeg, right?

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions