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

autocomplete for /home/user/.luarocks #29

Open
laoshaw opened this issue May 7, 2020 · 4 comments
Open

autocomplete for /home/user/.luarocks #29

laoshaw opened this issue May 7, 2020 · 4 comments
Assignees
Labels

Comments

@laoshaw
Copy link

laoshaw commented May 7, 2020

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
Copy link
Owner

Alloyed commented Oct 15, 2020

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

@Alloyed Alloyed self-assigned this Oct 15, 2020
@Alloyed Alloyed added the bug label Oct 15, 2020
@lexisother
Copy link

...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
Copy link

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
Copy link

How to make it support macOS Hammerspoon code completing?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants