Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » Lua Development Tools » LDT code analysis and code assistance is not working
LDT code analysis and code assistance is not working [message #885629] Wed, 13 June 2012 10:54 Go to next message
Cheyi Lin is currently offline Cheyi LinFriend
Messages: 16
Registered: June 2012
Junior Member
Hi,

Don't know how to configure LDT to make it works ... Crying or Very Sad

[hello.lua]
local m = {}

function m.print()
    print("hello")
end

function m.test()
    m.print()    -- press F3 on 'print' won't go to declaration
                 -- with error: current text selection does not resolve to a script element
end

return m


[main.lua]
local hello = require("hello")

hello.test()    -- 1) no code assist
                -- 2) press F3 on 'test' won't go to declaration in 'hello.lua'
                -- same error: current text selection does not resolve to a script element


Any ideas?

Regards
Re: LDT code analysis and code assistance is not working [message #891291 is a reply to message #885629] Sun, 24 June 2012 15:27 Go to previous messageGo to next message
Cheyi Lin is currently offline Cheyi LinFriend
Messages: 16
Registered: June 2012
Junior Member
Hi me again,

I download the standalone LDT, run it and ignore the LDT update notification, then I found everything is working fine.

software version:
Lua Development Tools (Incubator)           0.1.0.201201241319
Lua Development Tools Product (Incubator)   0.1.0.201201231446


but after I update the LDT, it is not working again.

software version:
Lua Development Tools (Incubation)          0.8.0.201206122001
Lua Development Tools Product (Incubator)   0.1.0.201201231446


Does version 0.8 need some addition settings?


Regards
Re: LDT code analysis and code assistance is not working [message #891733 is a reply to message #891291] Mon, 25 June 2012 16:23 Go to previous messageGo to next message
Benjamin Cabé is currently offline Benjamin CabéFriend
Messages: 201
Registered: July 2009
Location: Toulouse, France
Senior Member

Hi Cheyi Lin,

Your code needs to be documented so as LDT can know what are the different methods contained in your module:

---
-- @module m
local m = {}

------------------------------------------------------------------------------
-- Print something
-- @function [parent=#m] print
function m.print()
    print("hello")
end

------------------------------------------------------------------------------
-- Test something
-- @function [parent=#m] test
function m.test()
    m.print()
end

return m


The reason behind the decision to go for a documentation format, and the perspectives there are of having heuristics to automatically detect some patterns & drive the code assistance is largely discussed here: http://www.eclipse.org/forums/index.php/mv/msg/351391/871701/#msg_871701

Please let us know if you still need help!
Benjamin.


Re: LDT code analysis and code assistance is not working [message #891795 is a reply to message #891733] Tue, 26 June 2012 03:06 Go to previous messageGo to next message
Cheyi Lin is currently offline Cheyi LinFriend
Messages: 16
Registered: June 2012
Junior Member
Thank you Benjamin, it works now.

I still have several questions

1.
In my example code, I saw 'm' listed twice in outline
...
[M] > m
     * test()
[o] m
...

The first one is the module, and the second one is the local variable. Is it normal?
It seems that all top level local variables are shown in outline. (including 'local string, io = string, io')

2.
In wiki page: wiki.eclipse.org/Koneki/LDT/Technical_Discussions/Documentation_Language (sorry I can't post link)
I don't understand the use of 'type comment block' and 'field comment block'.
Could you please explain these with some code examples?

Regards,
Cheyi

Re: LDT code analysis and code assistance is not working [message #894585 is a reply to message #891795] Mon, 09 July 2012 17:40 Go to previous message
Simon Bernard is currently offline Simon BernardFriend
Messages: 345
Registered: July 2009
Senior Member
Hi,

1.
This is the expected behavior. The first 'm' is the module (@module m) and the second one the local variable (local m = {}).

This is maybe a bit weird but currently the IDE is not able make the link between this 2 declaration.

2.
The 'type comment block' is used to describe a type, like a file handle in the io module.
This type could be returned by function (like open in io module).
Thanks to this information, in some case, we are able to infer type to local variable and so propose relevant auto-completion.

The 'field comment block' is used to attach a field to a type (or to a module, in fact a module is managed like a type). A field is a table index which is not a function like stdin in the io module.

You could download and add the Lua 5.1 execution environment support to your project to test the io module and so the possibility of type and field comment block.
Previous Topic:Debugging wxLua programs
Next Topic:Issues with Source Mapping
Goto Forum:
  


Current Time: Tue Mar 19 06:10:31 GMT 2024

Powered by FUDForum. Page generated in 0.02411 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top