Skip to content

emmylua-ls thinks a required module could be the current file, generating false positive type-mismatch warnings #992

@haoming-li-ling

Description

@haoming-li-ling

Wezterm's config file could be just name wezterm.lua. In that file, you are supposed to require("wezterm"), which is provided by Wezterm's lua runtime, and it is not referring to the current file. But then emmylua-ls thinks that the type of require("wezterm") is the return type of the current file, likely equating the wezterm module with the current file.

-- file name is `wezterm.lua`
local wezterm = require("wezterm")  ---@type Wezterm
local config = wezterm.config_builder() ---@type Config

return config

emmylua-ls complains that W Cannot assign Config to Wezterm.

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