Skip to content

bug: LuaLS 3.13.3 breaks @class inheritance optional @fields annotations hack #274

@minusfive

Description

@minusfive

Did you check docs and existing issues?

  • I have read all the snacks.nvim docs
  • I have updated the plugin to the latest version before submitting this issue
  • I have searched the existing issues of snacks.nvim
  • I have searched the existing issues of plugins related to this issue

Neovim version (nvim -v)

0.10.2

Operating system/version

MacOS 14.6.1

Describe the bug

As of LuaLS v3.13.3 the @class inheritance hack to mark all @fields as optional no longer works. As a consequence all config fields appear mandatory now, and a wall of warnings is shown.

This typing hack seems to be pervasive across the Lua ecosystem, so not sure what next steps should be. In the meantime it seems the only solution is to explicitly declare all @fields as optional (?).

Submitting this bug primarily as a way to track this issue. Will try and submit a PR when I have a chance.

Screenshot 2024-12-13 at 00 43 52

Steps To Reproduce

  1. Update LuaLS
  2. Peruse configs and behold the wall of "missing fields" warnings

Expected Behavior

All config fields should be explicitly marked as optional.

Repro

vim.env.LAZY_STDPATH = ".repro"
load(vim.fn.system("curl -s https://raw.githubusercontent.com/folke/lazy.nvim/main/bootstrap.lua"))()

require("lazy.minit").repro({
  spec = {
    {
      "folke/snacks.nvim",
      opts = {
        ---@type snacks.dashboard.Config
        dashboard = {}
      }
    },
  },
})

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions