Skip to content

pluginPath is not added to package.path #1297

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Closed
Nexela opened this issue Jul 8, 2022 · 0 comments · Fixed by #1376
Closed

pluginPath is not added to package.path #1297

Nexela opened this issue Jul 8, 2022 · 0 comments · Fixed by #1376
Labels
enhancement New feature or request

Comments

@Nexela
Copy link
Contributor

Nexela commented Jul 8, 2022

pluginPath is not added to package.path

Currently if a plugin wants to require additional plugin files some extra work is needed.

So far I have done this but I am not even sure if that is right or if there is an easier way.

local fs = require("bee.filesystem")
local workspace = require("workspace")
local scope = require("workspace.scope")

local plugin_path = fs.path(scope.getScope(workspace.rootUri):get('pluginPath'))
local new_path = (plugin_path:parent_path() / "?.lua"):string()
if not package.path:find(new_path, 1, true) then
  package.path = package.path..";"..new_path
end
@sumneko sumneko added the enhancement New feature or request label Jul 8, 2022
Nexela added a commit to Nexela/lua-language-server that referenced this issue Jul 23, 2022
Adds config.runtime.plugingArgs
Adds pluginPath to package.path. Closes LuaLS#1297
Adds log.warn() when specified plugin can't be found
Possible Changelog entry:
```txt
* `NEW` `Lua.runtime.pluginArgs`
* `CHG` add plugin path in package.path
```
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants