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

3.4版本的字段没有自动追踪

Open Philofallever opened this issue 3 years ago • 2 comments

Describe the bug 我们项目有很多UI脚本,这些脚本只会挂在UI上,不会在项目其他代码中引用,所以不想让它成为一个单独的类出现在智能提示中,

之前使用---@type 父类来标记它,这样既能使用它父类中的方法,又不会出现在智能提示中,但是在3.4的版本中, 这些脚本的字段不能追踪了,写起来不太方便. 之前3.2还是3.1的版本都是可以的

To Reproduce image

如上图定义一个脚本类,方法Init中添加了一个字段 _nameInput,在TestCase方法中没有_nameInput的智能提示. 鼠标防在类名上又显示有这个字段,如下图所示: image

Philofallever avatar Jul 08 '22 12:07 Philofallever

改用 ---@class Command。 至于外部不能使用,以后会通过 ---@field private field type 来 实现。

sumneko avatar Jul 08 '22 12:07 sumneko

改用 ---@class Command。 至于外部不能使用,以后会通过 ---@field private field type 来 实现。

不是的. 整个LeagueCreateCmd都不需要出现在智能提示中, 因为不会被其他lua代码引用.
原来是没有加注解的, 加---@type Command 是为了可以在智能提示中显示Command的方法

Philofallever avatar Jul 12 '22 10:07 Philofallever

@sumneko 老铁能不能在看看这个问题 😃 :

Philofallever avatar Aug 29 '22 02:08 Philofallever

你现在必须得给它分配一个类型,---@class UIXXX: Command

sumneko avatar Aug 29 '22 06:08 sumneko