Alloyed / lua-lsp

A Lua language server
MIT License
288 stars 21 forks source link

autocomplete for /home/user/.luarocks #29

Open laoshaw opened 4 years ago

laoshaw commented 4 years ago

I edited $HOME/.luacompleterc

{
    "luaVersion": "5.1",
    "packagePath": "./?.lua;/home/user/.luarocks/share/lua/5.1/?.lua"
}

I did luarocks install --local lua-cjson I added $HOME/.luarocks into package.path and package.cpath.

When I use vim I can autocomplete standard Lua functions(table.insert, io.open,etc), however I can not autocomplete anything from $HOME/.luarocks/share/lua/5.1, vim displays:

User defined completion(^U^N^P) Pattern not found.

So will lua-lsp be able to index all files under $HOME/.luarocks/share/lua/5.1 somehow? what about the C modules under package.cpath? I want to do auto-complete for all imported modules and my own lua files in addition to the working built-in Lua functions(e.g. os.open etc)

Alloyed commented 4 years ago

So this should definitely work; the fact that isn't is a bug. will look into :eyes:

lexisother commented 2 years ago

...bump? It doesn't seem like this has been fixed. I'm trying to use the following library: https://github.com/Desvelao/lummander As evident from the code, all functions have LuaDoc indicating they are fit for completion:

-- Create a command. This function is called by Lummander.
-- @tparam string command Command to parse for extract arguments and their requirements.
-- @tparam[opt={}] table config Options.
-- @tparam[opt=""] string config.description Command description.
-- @tparam[opt={}] table config.positional_args Command description.
-- @tparam[opt] {options} config.options CommandOptions
-- @tparam[opt=false] boolean config.hide Hide from help command
-- @tparam[opt=false] boolean config.main Set as main cli command
-- @tparam[opt] function config.action Command action function.
-- @tparam Lummander lummander CommandOptions
-- @treturn Command
function Command.new(command, config, lummander)

(source: https://github.com/Desvelao/lummander/blob/8b5c07642a322b7874f676f743d0e801c6e5b907/lummander/command.lua#L10-L21)

Though... I'm not getting any completion. Here's my ~/.luacompleterc:

{
    "luaVersion": "5.1",
    "packagePath": "./?.lua;/home/user/.luarocks/share/lua/5.1/?.lua"
}

And here's the plugin doing nothing: afbeelding

You mind looking into this again, even though I'm abysmally late?

lexisother commented 2 years ago

You know, I'm getting the feeling that whatever searches packagePath, it does not traverse to subdirectories. I added the path of the module I want autocomplete for to packagePath, and it instantly started working wonders: afbeelding Is there a way to make it recurse directories, or perhaps support wildcards such as **/?.lua?

stardiviner commented 1 year ago

How to make it support macOS Hammerspoon code completing?