Skip to content

Code completion breaks when a global table is reassigned #1038

@Yoctillion

Description

@Yoctillion

When a global table variable is assigned multiple times — a common pattern in API definition files or defensive initialization like:

GlobalScope = GlobalScope or {}

code completion (intellisense) stops working for that table and its members.

Expected behavior:

The LSP should merge or resolve the type information across multiple assignments and continue providing code completion.

Actual behavior:

Code completion is unavailable after the table is reassigned, even if the type can be statically inferred.

Reproduction:

-- file: api1.lua
GlobalScope = {}
GlobalScope.foo = function() end

-- file: api2.lua
GlobalScope = {} -- or GlobalScope = GlobalScope or {}
GlobalScope.bar = function() end

-- file: main.lua
GlobalScope.  -- no completion suggestions

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