Skip to content
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: EmmyLua-like metamethod documenting #1188

Closed
Feez opened this issue Jun 1, 2022 · 2 comments
Closed

Feature: EmmyLua-like metamethod documenting #1188

Feez opened this issue Jun 1, 2022 · 2 comments
Labels
duplicate This issue or pull request already exists enhancement New feature or request feat/LuaCats Annotations Related to Lua Language Server Annotations (LuaCats)

Comments

@Feez
Copy link

Feez commented Jun 1, 2022

It would be awesome if we included some type of EmmyLua documentation extension to support metamethods (particularly the Mathematic Operators).

I'd like to be able to code something like this:

---@class MyClass
---@metamethod add fun:(self: MyClass, other: MyClass) : MyClass
---@metamethod subtract fun:(self: MyClass, other: MyClass) : MyClass
local x = {}

---@type MyClass
local a

---@type MyClass
local b

--- Ideally, `c` would be inferred to be MyClass off of the annotations
local c = a + b
@Frityet
Copy link
Contributor

Frityet commented Jun 1, 2022

This would be really useful for __call aswell!

local tbl = setmetatable({}, {
	__call = function (s) return s end
})

print(tbl("Hi"))

@sumneko sumneko added enhancement New feature or request feat/LuaCats Annotations Related to Lua Language Server Annotations (LuaCats) labels Jun 4, 2022
@sumneko
Copy link
Collaborator

sumneko commented Jun 30, 2022

see #599

@sumneko sumneko closed this as completed Jun 30, 2022
@sumneko sumneko added the duplicate This issue or pull request already exists label Jun 30, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate This issue or pull request already exists enhancement New feature or request feat/LuaCats Annotations Related to Lua Language Server Annotations (LuaCats)
Projects
None yet
Development

No branches or pull requests

3 participants