Skip to content

Feature Request: Environment Scoping #780

@SlashScreen

Description

@SlashScreen

This is perhaps a niche use case, but some applications have different APIs available in different contexts (this set in a menu, this set in-game, this set in plugins, etc.). While arguably not a great design decision, is often unable to be changed because of legacy. What would be great is a way to scope members by these environments for the docs generator and the LS.

Usage:

To scope a member, you can give it an @env x... directive. For example, this function would be in the x and y environments.

--- @env x y
function foo()
  bar()
end

To restrict a file to a certain environment, place the directive at the beginning of the file:

-- x.lua
--- @env x

Then, foo is available here, since it's in env x.

Members unlabelled with an environment would belong to a "default" environment which is accessible from all environments. Unlabelled files would only have the default env available.

Generation

Each environment, including the default one, would get a generated doc_x.json . If there's only a default, there's only a doc.json.

Hopefully this isn't too hard to implement, as it's mostly just set theory manipulation.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions