Skip to content

Support specifying globals inside Lua files #1464

Open
@Zamiell

Description

@Zamiell

Currently, when using this language server, you get warnings for global variables:

if someGlobalVariable then -- Undefined global `someGlobalVariable `. Lua Diagnostics.(undefined-global)
  print("wow!")
end

The way to squelch them is to add the globals to the VSCode settings. But this is too much of a sledgehammer, as we might only want the globals to be enabled in this specific file. Thus, we should also add a feature so that end-users can specify the globals in-line:

-- We specify a list of globals at the top of the file.
-- @global someGlobalVariable 

someCode()

if someGlobalVariable then -- No warning.
  print("wow!")
end

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions