-
-
Notifications
You must be signed in to change notification settings - Fork 336
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
Fix missing-fields diagnostic not warning about missing inherited fields #2970
Fix missing-fields diagnostic not warning about missing inherited fields #2970
Conversation
Also added tests for it
Hi @estebanfer, when closing multiple issues, you have to write the Should close #2337, close #2598, close #2740, close #2966 (just edit your existing PR description is enough) You can verify this on the right hand side section of this PR page: |
Thank you! |
Is there a setting to explicitly disable the warning about inherited fields? Or you have to disable |
It is considered as a bug by not reporting missing inherited fields before, so there is no option to disable only missing inherited fields Consider the following example: ---@class Parent1
---@field parent1 string
---@class Child1: Parent1
---@type Child1
local c1 = {}
--> missing-fields: Missing required fields in type `Child1`: `parent1`
-- `parent1` is shown because it is a required field
---
---@class Parent2
---@field parent2? string
---@class Child2: Parent2
---@type Child2
local c2 = {}
--> no warning, as `parent2` is optional Can you elaborate on the use case in why you want to explicitly disable this warning 🤔 ? |
It's really nothing. I've just started learning programming at the start of this year and I try to contribute a little bit in Neovim plugins, since that is the editor I use. As an example a plugin has the following So, not a big deal and I understand they should be shown, but if I'm working with other types not implemented in the plugin itself, then I really don't want to see the warnings about those inherited values. Just a personal preference. |
Ah~ I see the examples in the cross linked issue now. And as commented in that issue, this feature is called partial class and currently not implemented in LuaLS. 🤔 ---@class Config
---@field a string
---@field b string
---@class Config.P: Config
---@field c string
---@type Config.P
local partialConfig = {} -- now every in `Config` is optional, will only warn for missing `c` If this PR is not going to be reverted, then I guess we must wait for someone to implement partial class. ---@class (partial) Config.P: Config
---@field c string And then in the
This maybe the minimum requirement for the partial class feature. cc @sumneko |
Should close #2337, close #2598, close #2740, close #2966