Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 370594

Summary: Outline for methods
Product: [Tools] LDT Reporter: Marc Ewert <lumi>
Component: LuaDevelopmentToolsAssignee: Project Inbox <ldt-inbox>
Status: CLOSED DUPLICATE QA Contact:
Severity: normal    
Priority: P3 CC: contact, malaperle, sbernard
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Windows 7   
Whiteboard:
Attachments:
Description Flags
Lua-File without any outline none

Description Marc Ewert CLA 2012-02-03 13:59:22 EST
Hi,

I just found this Lua plugin for Eclipse and I'm totally happy, because the other plugins I've used so far are outdated and buggy. Thank you very much for this! :-)

One thing I've found: It would be great, if the outline window also shows occurences with the following method syntax:

function lootlog.LootLog:ChatCommand(msg)
    -- ...
end

Currently only local function like the following one are shown for me:

local function _InitPatterns(self)
    -- ...
end

I'm using version "Lua Development Tools (Incubator) 0.1.0.201202031443"
Comment 1 Benjamin Cabé CLA 2012-02-23 12:21:44 EST
Hi Marc, and sorry for answering a bit late!
I think it is unlikely that we will be able to provide an outline for this syntax.
I don't know much about the limitations that may exist in the Lua VM of WoW, but you may want to use clearly defined modules (see http://lua-users.org/wiki/ModuleDefinition )

On a related note, we have been working on a way to provide much better content assist for people developing modules ; this has been explained here: http://lua-list.2524044.n2.nabble.com/ANN-Koneki-LDT-smart-content-assist-available-in-beta-td7287990.html
Comment 2 Marc Ewert CLA 2012-02-23 15:21:03 EST
Hi Benjamin,

most of the WoW-Addons use this notation because of the widespread library Ace3. By using the colon one doesn't need to declare the "self" variable. But   "function LootLog.ChatCommand(self, msg)" is also not accepted by the outline parser. We (the WoW authors) will probably not be able to change how our Modules/Classes are coded, as long as we don't rewrite at least the Ace3 library.
Comment 3 Marc Ewert CLA 2012-02-27 12:31:20 EST
Created attachment 211678 [details]
Lua-File without any outline

Hi,

I was able to produce a valid Lua file without any outline entries. Even the local functions are not shown, as they did before. Something is disturbing the outline-parser, although the file is valid. At least World of Warcraft doesn't complain.

For me personally it would be enough, when the outline view just shows the first capture group of the patterns "function (.*\()\(". :-)
Comment 4 Benjamin Cabé CLA 2012-02-27 12:47:26 EST
Hi Marc,

In lines 323:325, you need to escape the backslashes.
The Lua VM will print "c" on the console if you print("\a\bc")   (i.e. it ignores characters that are not supposed to be escapable).

The thing is Metalua (which we used to build the outline and stuff) is a bit more strict in its source code parsing, thus it failed at parsing the badly escaped strings. In this case it is your lucky day since it spotted a potential bug in your code! (even though maybe the WoW VM had treated the strings correctly in your case?).
Comment 5 Marc Ewert CLA 2012-02-27 13:40:55 EST
Hi Benjamin,

ah, thanks for the info. I remember days, where WoW didn't like the missing "\". But nowadays it doesn't complain about it and the referenced texture is shown without any problem. Perhaps the WoW-programmers also oftenly forget to add the second backslash. ;-)
Comment 6 Simon Bernard CLA 2012-06-05 06:04:17 EDT
Hi, 
We plan to work on an enhancement which may support this kind of notation ,even though supporting this way to declare a function is not a priority.

*** This bug has been marked as a duplicate of bug 381671 ***