goto function in table

Issue #149 resolved
created an issue

Good afternoon Jon, firstly thanks for creating the plugin, it has been fantastically useful for me for a couple of years now. I have been having trouble with the middle click/ctrl-click 'goto' function for a while now on the later versions of intellijidea with your plugin. Hopefully it's just something I'm doing wrong. The following works for me in IDEA11 with your plugin but not any later: I have a number of .lua files which I require from my main program, many contain global functions. I declare a global table GTX={}, and a number of these lua files then store functions to these tables. for example GTX.DebugClock() In Idea 11 if I then middle click on the 'DebugClock' it takes me to the correct file and place where the function is created. In later versions (I've just downloaded 13.1 and latest plugin this morning) it doesn't work, it says 'cannot find declaration to go to'. If I call a function without storing it within the global table it works fine wherever in the project it is created.

Any idea why this is?


Comments (12)

  1. Jon S Akhtar repo owner

    Yes, later version of the plugin support references from fields, but there are still issues I have never addressed. Can you please provide a code sample.

  2. Robert M.

    Maybe I can:

    Foo = {}
    function Foo.doStuff()
     -- ...
    Bar = {};
    function Bar.init()
        -- Click on Foo -> Go To -> Decleration (works)
        -- Click on doStuff() -> Go To -> Decleration (fails: 'Cannot find declaration to go to')

    Hope that helps.

  3. Jon S Akhtar repo owner

    2014-05-11_10-43-03.pngOh yes. The type inference code that made this scenrio work was broken in idea13. I am pushing a build now with a fix.

    It still wont navigate back, but discovered this was not working when I tested this

  4. Jon S Akhtar repo owner

    Earlier versions of the plugin used to store identifiers like Foo.doStuff as if they were globals. This worked in practice, but was not really correct. You couldn't for example navigate from Foo.doStuff to Foo by ctrl-clicking on the Foo portion.

    Also, all the completions displayed the combined symbols, so if you typed Foo. you would see Foo.doStuff in the completions instead of just doStuff.

    I made this work for module(), so if you define functions in a module Foo, function doStuff() end. Then in your code Foo.doStuff() will navigate properly.

    What you are asking for is Lua 5.2 style modules sort of, and that is something I still haven't gotten around to.

  5. Log in to comment