-
-
Notifications
You must be signed in to change notification settings - Fork 353
在拥有类继承关系的变量值上,自动补全可能不全 #318
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
Comments
看着根本原因是 getRefCache() 获取错误 cache 导致的。
== 细节版 == 下面用例放到 test\diagnostics\init.lua TEST [[
---@class Foo
Foo = {}
function Foo:Constructor()
self.bar1 = 1
end
---@class Foo2: Foo
local Foo2 = {}
function Foo2:Constructor()
self.bar2 = 1
end
---@type Foo2
local v
print(v.bar1)
]]
添加断点红框代码测试代码,第二次命中时会出现复现版堆栈。
有什么好的修改意见没? |
晚点研究一下 |
之前我也尝试修改过。对于单点的我示例里的问题,因为获取 cache 失败导致的 searchSameFieldsCrossMethod() 穿透失败,感觉可能通过在 cache 上新增未完成标志做出特殊处理。但这个获取cache可能失效的情况,看着也会影响其他逻辑,最好能从根本上处理,但可能还缺乏对你之前思考的理解,没想到什么好的方法。 |
原因是穿越method的标记,从外往里穿的时候是共享了一个全局标记,导致穿过一次以后就穿不了了。我改成了每个method用单独的标记了。 |
同一个对象就是不应该在 searchRefs 的过程中再次 searchRefs 的,否则不就死循环了吗。 |
同意。我想表达的意思是,能不能把最上面的 searchRefs() 调用去除。因为多的这一次调用,可能导致其他逻辑被影响。 |
如果去掉后测试可以通过就行 |
目前想着不成熟的可能做法是这样:
对我而言,可能还要继续熟悉你的代码,才能做类似的开发了。btw,我在调试时,有时会发现 queue 里同一条目多次出现,要是能把它优化掉去除冗余,可能对查找速度也会有些帮助了。 |
过滤的话,直接在share里做标记就行了 |
目前对性能影响比较大的应该是后退查找太多了,这个我之后会想办法优化一下,哪怕牺牲一些准确度。 local v = t
v.<!x!> = 1
print(t.<?x?>) |
嗯嗯确实queue有同条目过滤。 |
Describe the bug

上面应该也提示 Foo 的 bar1、bar2 才对,结果只有 Foo2 的 bar3。
To Reproduce
拷贝上面内容到新lua文件,对“print(v.)”里的
.
删除再重输,可复现。Expected behavior
应该 bar1、bar2、bar3 均出现。
btw,如果 Foo、Foo2 为 local 变量,而不是全局变量,不会有上述问题。
Screenshots
上面已附加
Environment (please complete the following information):
Additional context
Add any other context about the problem here.
The text was updated successfully, but these errors were encountered: