LuaLS / LuaLS/lua-language-server
Operators can only be defined one way
Open
Nobody has claimed this yet.
enhancement
- Dominant language
- Lua
- Stars
- 4.4k
- Forks
- 442
- PR merge metrics
- No merged PRs in 30d
Description
Describe the bug
Its seems like operators can only be defined one way? I want number * Vec3 to be Vec3. Am I missing something?
To Reproduce
--- @class Vec3
--- @operator mul(number): Vec3
local Vec3 = {}
local t1 = Vec3() * 2 ---Vec3
local t2 = 2 * Vec3() --Integer!
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the Lua example in the issue, comparing Vec3() * 2 with 2 * Vec3(). Trace the language-server operator annotation handling and define completion as making both operand orders infer Vec3 consistently, with regression coverage for the shown cases.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- lua
- Domain
- devtools
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100