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

Cannot inherit from class alias

Open PinewoodPip opened this issue 10 months ago • 3 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?

Annotations

Expected Behaviour

If I have an @alias for a class, I expect it to be usable in inheritance for other classes, ex. @class MyNewClass : MyAlias

Actual Behaviour

The inheritance triggers undefined-doc-class diagnostic although the alias can still be ctrl+clicked to go to its source.

Reproduction steps

Snippet that reproduces the issue:

---@class MyClass

---@alias MyAlias MyClass

-- Will trigger undefined-doc-class, though MyAlias can be ctrl+clicked to go to source.
---@class MyNewClass : MyAlias

Additional Notes

No response

Log File

service.log

PinewoodPip avatar Apr 20 '24 16:04 PinewoodPip

Since ---@alias annotations can stand for more than just ---@class annotations, I vote for not implementing this feature and closing as won't fix.

C3pa avatar Apr 22 '24 16:04 C3pa

What is the alias being used for? Why not just use the class's name?

Krunklehorn avatar May 24 '24 21:05 Krunklehorn

What is the alias being used for? Why not just use the class's name?

---@alias MyAlias MyClass | AnotherClass

Venusta avatar Jun 08 '24 19:06 Venusta