Skip to content

how to setup plugin dependencies #21

@ChillerDragon

Description

@ChillerDragon

I have a lls-addon that ships a plugin.lua which depends on a module published as luarocks package. I did luarocks init to get a local lua_modules/ directory. Then I installed the lls-addon using luarocks install lls-addon-ddnetpp it specified the dependency to the "luluworlds-params" package which also got downloaded. Now my directory looks like this:

$ tree
.
├── foo.lua
├── lua_modules
│   ├── lib
│   │   └── luarocks
│   │       └── rocks-5.5
│   │           ├── lls-addon-ddnetpp
│   │           │   └── 0.6-4
│   │           │       ├── library
│   │           │       │   ├── character.lua
│   │           │       │   ├── ddnetpp.lua
│   │           │       │   └── player.lua
│   │           │       ├── lls-addon-ddnetpp-0.6-4.rockspec
│   │           │       ├── plugin.lua
│   │           │       ├── rock_manifest
│   │           │       └── src
│   │           │           ├── params_type.lua
│   │           │           └── plugin_parser.lua
│   │           ├── luluworlds-params
│   │           │   └── 1.1-0
│   │           │       ├── doc
│   │           │       │   └── README.md
│   │           │       ├── luluworlds-params-1.1-0.rockspec
│   │           │       └── rock_manifest
│   │           └── manifest
│   └── share
│       └── lua
│           └── 5.5
│               └── luluworlds
│                   └── params.lua
└── plugins-dev-1.rockspec

When I then open the sample script foo.lua in my editor it asks if I want to load the plugin. I click yes. And then it crashes.
The log shows the following error:

$ cat /tmp/loggies/file_home_chiller_Desktop_gaming_DDNetPP_build_plugins.log

[..]
[15:22:28.149][info] [#0:script/workspace/loading.lua:172]: Loaded files takes [0.103] sec: <fallback>
[15:22:28.149][info] [#0:script/workspace/loading.lua:181]: Compile files takes [0.000] sec: <fallback>
[15:22:28.149][info] [#0:script/workspace/loading.lua:182]: Loaded finish:      <fallback>
[15:22:28.149][info] [#0:script/workspace/workspace.lua:389]: Preload finish at:        <fallback>
[15:22:28.150][info] [#0:script/workspace/loading.lua:172]: Loaded files takes [0.104] sec: file:///home/chiller/Desktop/gaming/DDNetPP/build/plugins
[15:22:28.150][info] [#0:script/workspace/loading.lua:181]: Compile files takes [0.000] sec: file:///home/chiller/Desktop/gaming/DDNetPP/build/plugins
[15:22:28.150][info] [#0:script/workspace/loading.lua:182]: Loaded finish:      file:///home/chiller/Desktop/gaming/DDNetPP/build/plugins
[15:22:28.150][info] [#0:script/workspace/workspace.lua:389]: Preload finish at:        file:///home/chiller/Desktop/gaming/DDNetPP/build/plugins
[15:22:28.153][info] [#0:script/client.lua:138]: responseMessage        The current settings try to load the plugin at this location:/home/chiller/Desktop/gaming/DDNetPP/build/plugins/lua_modules/lib/luarocks/rocks-5.5/lls-addon-ddnetpp/0.6-4/plugin.lua

Note that malicious plugin may harm your computer
        Trust and load this plugin

[15:22:28.154][error][#0]: ...ks/rocks-5.5/lls-addon-ddnetpp/0.6-4/src/params_type.lua:1: module 'luluworlds.params' not found:
        no field package.preload['luluworlds.params']
        no file '/home/chiller/.local/share/nvim/mason/packages/lua-language-server/libexec/script/luluworlds/params.lua'
        no file '/home/chiller/.local/share/nvim/mason/packages/lua-language-server/libexec/script/luluworlds/params/init.lua'
        no file '/home/chiller/Desktop/gaming/DDNetPP/build/plugins/lua_modules/lib/luarocks/rocks-5.5/lls-addon-ddnetpp/0.6-4/luluworlds/params.lua'
        no file '/home/chiller/.local/share/nvim/mason/packages/lua-language-server/libexec/bin/luluworlds/params.so'
        no file '/home/chiller/.local/share/nvim/mason/packages/lua-language-server/libexec/bin/luluworlds.so'
stack traceback:
        [C]: in global 'require'
        ...ks/rocks-5.5/lls-addon-ddnetpp/0.6-4/src/params_type.lua:1: in main chunk
        [C]: in global 'require'
        .../rocks-5.5/lls-addon-ddnetpp/0.6-4/src/plugin_parser.lua:1: in main chunk
        [C]: in global 'require'
        ...ib/luarocks/rocks-5.5/lls-addon-ddnetpp/0.6-4/plugin.lua:6: in main chunk
        [C]: in global 'xpcall'
        script/plugin.lua:157: in function <script/plugin.lua:95>
[15:22:28.154][info] [#0:script/client.lua:112]: ShowMessage    Error   An error occurred in the plugin, please report it to the plugin author.
Please check the details in the output or log.
Plugin path: /home/chiller/Desktop/gaming/DDNetPP/build/plugins/lua_modules/lib/luarocks/rocks-5.5/lls-addon-ddnetpp/0.6-4/plugin.lua

[15:22:28.155][info] [#0:script/provider/diagnostic.lua:560]: Diagnostics scope [file:///home/chiller/Desktop/gaming/DDNetPP/build/plugins], files count:[15]
[15:22:28.159][info] [#0:script/provider/diagnostic.lua:577]: Diagnostics scope [file:///home/chiller/Desktop/gaming/DDNetPP/build/plugins] finished, takes [0.004] sec.
[15:25:38.420][warn] [#0:script/pub/report.lua:24]: Load proto error:   Disconnected!

Interesting to me is that it almost found the file. As you can see in the error it looked for this file

no file '/home/chiller/Desktop/gaming/DDNetPP/build/plugins/lua_modules/lib/luarocks/rocks-5.5/lls-addon-ddnetpp/0.6-4/luluworlds/params.lua'

which is super close to the actual location in the filesystem which is this

/home/chiller/Desktop/gaming/DDNetPP/build/plugins/lua_modules/share/lua/5.5/luluworlds/params.lua

So from what I can tell the lua require within the plugin

local tw_console = require("luluworlds.params")

looks for the file in a different location than it is being installed to but it is being installed its not missing.

Image

The readme does mention dependencies. Are these just for type annotations in library/ or also for plugins?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions