LuaCoderAssist icon indicating copy to clipboard operation
LuaCoderAssist copied to clipboard

是否可以增加支持跨文件的"转到定义"功能?

Open DFVSQY opened this issue 5 years ago • 4 comments

如下图,如果调用的函数在其他文件里,则按下f12提示“未找到xxx的任何定义” image

DFVSQY avatar Jan 05 '20 12:01 DFVSQY

@DFVSQY 看不到图片呢,如果想要跳转到其他文件中定义的符号,首先需要加载符号所在的文件,要么require这个符号所在的文件,要么可以通过preload配置做预加载。 该插件采用的是懒惰加载的方案,只会加载文件显式依赖(通过require)的外部模块,主要是考虑加载的性能,如果你想全部加载整个工程的文件,可以通过preload配置来实现。

Lua Coder Assist: Preloads
Preload modules path, can be file or directory. DO NOT config a dirctory with a lot files for performance consideration. If a directory configured has a init.lua file, the file will be loaded instead of all file under this directory, otherwise, files in the directory and its subdir will be loaded

liwangqian avatar Jan 18 '20 12:01 liwangqian

刚才打开图片看到你的示例代码了,是这样的,这个插件当前还没办法推导函数参数类型,lua是弱类型语言,仅从代码是不知道cellskipGo是什么类型的,也就不知道它有哪些属性和方法了。 其他插件有方法来做这个事情,就是通过标注来描述参数的类型,这个就需要开发人员写标注了,这个插件当前不支持标注。

liwangqian avatar Jan 18 '20 12:01 liwangqian

@liwangqian 由于lua是若弱语言类型,我想这个功能没必要做的那么准确,只需要通过按下F12能列出来有哪些符合symbol名称的函数即可,具体跳转到哪一个完全由用户决定。类似的功能可以参考lua_tags插件

DFVSQY avatar Jan 19 '20 09:01 DFVSQY

暂时没时间搞,后面再看吧

liwangqian avatar Feb 05 '20 13:02 liwangqian