-
-
Notifications
You must be signed in to change notification settings - Fork 335
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
Feature Request: Deprecate fields and parameters #1313
Comments
You can use |
how 🤔 im trying ---@class foo
---@deprecated
---@field example string
foo = {} but it does not work |
Would like to see this as well. |
I see that it partially works because you can use on Lua code---@deprecated -- does nothing
---@class foo
---@field example string
local foo = {}
---@deprecated
---@type string
foo.example2 = nil
print(foo)
print(foo.example) -- cant mark as deprecated
print(foo.example2)
---@class foo2
---@deprecated -- breaks the local class declaration, and does nothing
---@field example string -- field must be defined after class
local foo = {}
---@deprecated
---@type string
foo.example2 = nil
print(foo)
print(foo.example) -- cant mark as deprecated
print(foo.example2)
---@class foo3
---@field example string
---@deprecated -- breaks the local class declaration, and does nothing
local foo = {}
---@deprecated
---@type string
foo.example2 = nil
print(foo)
print(foo.example) -- cant mark as deprecated
print(foo.example2)
---@deprecated
---@class gfoo
---@field example string
gfoo = {}
---@deprecated
---@type string
gfoo.example2 = nil
print(gfoo)
print(gfoo.example) -- cant mark as deprecated
print(gfoo.example2) -- deprecated as expected, but the whole class deprecated, so field is skipped visually
---@class gfoo2
---@deprecated -- still works for class
---@field example string -- field must be defined after class
gfoo = {}
---@deprecated
---@type string
gfoo.example2 = nil
print(gfoo)
print(gfoo.example) -- cant mark as deprecated
print(gfoo.example2) -- deprecated as expected, but the whole class deprecated, so field is skipped visually
---@class gfoo3
---@field example string
---@deprecated -- still works for class
gfoo = {}
---@deprecated
---@type string
gfoo.example2 = nil
print(gfoo)
print(gfoo.example) -- cant mark as deprecated
print(gfoo.example2) -- deprecated as expected, but the whole class deprecated, so field is skipped visually |
From luals wiki, the Though it works on table fields to some extend: ---@class foo
---@field example string
local foo = {}
foo.example = nil ---@deprecated this is the deprecate msg
print(foo.example) --> Deprecated.(this is the deprecate msg)
--> no need @type, it's already `(field) foo.example: string` However there is another greater problem 😕
---@class foo
---@field example string
local foo = {}
foo.example = nil ---@deprecated this is the deprecate msg
print(foo.example) --> the deprecate warning is gone ...
-- because the follow assignment statement to that field doesn't have @deprecate
foo.example = nil |
Could really use a clean way to mark specific field and parameters as deprecated. Currently I'm adding @**[DEPRECATED]** to the start of the comments for the field/parameter, but this doesn't change the name with a strike-through (as happens with functions).
The text was updated successfully, but these errors were encountered: