lua-language-server
lua-language-server copied to clipboard
add custom operator support for number and integer
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);
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
see #1371