Skip to content

pluginPath is not added to package.path #1297

@Nexela

Description

@Nexela

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions