lua-language-server icon indicating copy to clipboard operation
lua-language-server copied to clipboard

How to make a third-party member function as deprecated

Open ChouUn opened this issue 6 months ago • 11 comments

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

  1. it not works first. QQ_1722841266627
  2. and works unexpectedly. QQ_1722841307997

Reproduction steps

  1. 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

ChouUn avatar Aug 05 '24 07:08 ChouUn