Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
4 tasks done
minusfive opened this issue Dec 13, 2024 · 2 comments
Closed
4 tasks done
Labels
bug Something isn't working

Comments

@minusfive
Copy link
Contributor

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 = {}
      }
    },
  },
})
@minusfive minusfive added the bug Something isn't working label Dec 13, 2024
@folke
Copy link
Owner

folke commented Dec 13, 2024

I'm not going to duplicate all configs in an optional type.
You'll have to wait till luals implements ---class (partial) foo: config, or provide a PR to luals for exactly this.

@folke folke closed this as not planned Won't fix, can't repro, duplicate, stale Dec 13, 2024
@tomlau10
Copy link

tomlau10 commented Jan 3, 2025

Hi, I come from LuaLS/lua-language-server#2970 and I just implemented the ---@class (partial) foo: config syntax in LuaLS/lua-language-server#3024, which in short brings back the original checking behavior for a class containing partial attribute.

Maybe you guys would like to keep an eye on it 👀 @minusfive @folke

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants