EmmyLua / IntelliJ-EmmyLua

Lua IDE/Debugger Plugin for IntelliJ IDEA
https://emmylua.github.io
Apache License 2.0
1.72k stars 285 forks source link

Alias: No usages found in Project and Libraries #550

Open nfet opened 1 year ago

nfet commented 1 year ago

Environment(环境)

name version
IDEA version 2023.1.2
EmmyLua version 1.4.3-IDEA231
OS MacOS Ventura 13.4

What are the steps to reproduce this issue?(重现步骤?)

  1. See Given Example Alias Class Structure Below
--- @class A
local A = {
    methodA = function()  end
}

--- @class B
local B = {
    methodB = function()  end
}
--- @alias AB A|B

What happens?(出现什么问题?)

--- @type AB
local o = {}

o.methodA()
o.methodB()

Main Bug:

  1. Mouse or cursor on o.methodA() and use Go to Declaration or Usages (CMD + Click or CMD+B) on the o.methodA()
    • Result: Works as Expected
  2. Mouse or cursor on o.methodB() and use Go to Declaration or Usages (CMD + Click or CMD+B) on the o.methodB()
    • Result: Renders "No usages found in Project and Libraries"

Alternate Event:

Switch alias to B occurring first before A

--- @alias AB B|A

Then Go to Declaration on o.methodA() no longer works and o.methodB() works because it's declared first on the alias. It seems that the "Go to Declaration or Usages" is only honoring the first alias and ignores all others.

  1. Mouse or cursor on o.methodA() and use Go to Declaration or Usages (CMD + Click or CMD+B) on the o.methodA()
    • Result: Renders "No usages found in Project and Libraries"
  2. Mouse or cursor on o.methodB() and use Go to Declaration or Usages (CMD + Click or CMD+B) on the o.methodB()
    • Result: Works as Expected

Any logs, error output, etc?(有没有什么log, error输出?)

Any other comments?(其它说明)

Shinzuh commented 1 year ago

Got the same problem, had to downgrade to IntelliJ-EmmyLua-1.3.11-IDEA231