lua-language-server
lua-language-server copied to clipboard
How to make a third-party member function as deprecated
How are you using the lua-language-server?
Visual Studio Code Extension (sumneko.lua)
Which OS are you using?
Windows
What is the issue affecting?
Diagnostics/Syntax Checking
Expected Behaviour
---@deprecated
M.add = M.add
The left one should have marked as deprecated immediately when used such as ~u:add~
Actual Behaviour
- it not works first.
- and works unexpectedly.
Reproduction steps
- Write the code
-- File A
---@class A
local A = {}
---@param attr string
function A.add(attr)
end
-- File B
---@class A
local B = A
---@deprecated
B.add = A.add
B.add('some attr')
We'll find that B.add havn't marked as deprecated 2. Keep write the followed
-- File C
---@class A
---@field add fun(attr: string)
local C = A
Additional Notes
My original intention was to mark a third-party member function as deprecated. As there was no straightforward way, I think, to do it, I had to use a lot of tricks, which led to more subsequent problems.
Log File
No response