Giter Club home page Giter Club logo

Comments (3)

stuartwang avatar stuartwang commented on May 20, 2024 1

非常感谢这么详细的 issue。 从状态栏我看到Luapanda已经正确启动了,根据描述能做同文件的跳转。

关于定义跳转部分,我们预设的逻辑是:
当用户进行定义跳转时,首先会去查阅当前文件中是否有这个定义,如果没有就查询它require的文件。按照require树向上查找。如果最后还是找不到,就会在工程中所有lua文件中查询。
我做了一个demo测试了一下同 working dictionary 跨文件的跳转,demo中是可以的(可能是demo代码简单的原因)。

但是有几种情况可能会影响查询:

  1. 假如A文件中有一个function定义,B文件中使用了这个function。在B文件中做定义跳转时,若A或B文件有语法错误,则可能查不到定义。原因是对于语法错误的文件, parser 没有生成AST,也无法做符号分析,造成查询失败。

  2. 对于一些稍复杂的逻辑中的定义, 比如嵌套的函数调用等,可能查询失败
    比如 table.insert(t, string.sub(s, j+1, i-1))
    原因是符号建立和查询是一个大的递归操作,可能我们其中有些逻辑没有处理到或是有bug,造成了符号没有按预期被创建,或是被查询到。

  3. lua是一种弱类型语言,变量类型/和全局变量的定义都很灵活。静态分析可能难以得出准确的结果,也会影响查询的准确度。

关于定义跳转和补全,其实我们是搭了一个框架,用户操作时插件就会按照框架中的逻辑递归查找,通常我们也需要借助对具体案例的调试才能够得到确切的原因。我们会逐步完善这个框架。如果遇到定义查找和代码补全的问题希望解决,可以抽象成一两个文件的简单用例(纯lua就行,不要求能运行起来,但不能有语法错误)发给我们。这样我们可以对具体案例进行分析。

再次感谢详细的 issue

from luapanda.

stuartwang avatar stuartwang commented on May 20, 2024 1

非常感谢,我看到用例了。 OpcodeX.swap_echo_return 没有办法正确跳转。
应该是 function/file 的返回值我们没有处理好,我们会修复一下~

from luapanda.

mosdeo avatar mosdeo commented on May 20, 2024

謝謝你的詳細回覆。這是根據實際目錄結構、函式結構,做出的測試案例。在我的環境上可以重現我在 Describe the bug 描述的「兩個可以,一個不能」
https://github.com/mosdeo/FailCase_LuaPandaCanNotGoToDefinition

from luapanda.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.