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

add custom operator support for number and integer

Open thoys opened this issue 3 years ago • 2 comments

This PR adds support for extending the number / integer operators.

For example if you have a Vector3 class that could be multiplied with now this will work

---@class integer
---@operator mul(Vector3): Vector3
---@class number
---@operator mul(Vector3): Vector3
local shouldShowupAsAVector3 = 1.0 * Vector3.New(1,2,3);

thoys avatar Jul 07 '22 12:07 thoys

First of all, thank you for your PR. But I don't think this can work, the operator should be a part of Vector3 instead of integer or number, but the current design does not support it as the second operation. In addition, you need to add unit testing

sumneko avatar Jul 07 '22 13:07 sumneko

see #1371

sumneko avatar Jul 26 '22 08:07 sumneko