Home » Archived » Koneki » Limited autocomplete issue
Limited autocomplete issue [message #1416978] |
Sun, 22 September 2013 02:51 |
|
Hi there,
If I take the following sample from this http://wiki.eclipse.org/Koneki/LDT/Technical_Documentation/Documentation_Language:
--- A module that allow to manage geometry shapes
-- @module geometry
local M = {}
--- A rectangle
-- @type rectangle
-- @field [parent=#rectangle] #number x horizontal position, 0 by default
-- @field [parent=#rectangle] #number y vertical position, 0 by default
-- @field [parent=#rectangle] #number width, 100 by default
-- @field [parent=#rectangle] #number height, 100 by default
local R = {x=0, y=0, width=100, height=100, }
--- Move the rectangle
-- @function [parent=#rectangle] move
-- @param #rectangle self
-- @param #number x
-- @param #number y
function R.move(self,x,y)
self.x = self.x + x
self.y = self.y + y
end
--- Create a new rectangle
-- @function [parent=#geometry] newRectangle
-- @param #number x
-- @param #number y
-- @param #number width
-- @param #number height
-- @return #rectangle the created rectangle
function M.newRectangle(x,y,width,height)
local newrectangle = {x=x,y=y,width=width,height=height}
-- set to new rectangle the properties of a rectangle
setmetatable(newrectangle, {__index = R})
return newrectangle
end
return M
And I save it as "geometry.lua".
Then in an another lua file I try to use it:
geo=require('geometry');
myRectangle = geo.newRectangle(1,1,1,1); --autocomplete work fine here
myRectangle. --??? autocomplete doesn't work anymore
or
geo=require('geometry');
geo.newRectangle(1,1,1,1). --??? autocomplete doesn't work either
Even in geometry.lua if I use newRectangle, it seem that the autocomplete won't be able to reach the variable and move method.
Alhought,
In the local scope of "geometry.lua"
R.y --autocomplete work fine here
Did I do something wrong?
I use Lua 5.1 with Koneki standalone 1.0
|
|
| | |
Re: Limited autocomplete issue [message #1417009 is a reply to message #1416984] |
Wed, 13 November 2013 11:49 |
|
Alright, I have one question(I'm currently testing with koneki 1.1_M2):
Let's say, I want to use the geometry module in an another module, such as a cartesianDiagram module.
--- A Cartesian Diagram
--@module cartesianDiagram
local geo=require("geometry");
M={}
--- A Cartesian Diagram Instance
-- @type cartesianDiagramInstance
-- @field [parent=#cartesianDiagramInstance] #number row, 0 by default
-- @field [parent=#cartesianDiagramInstance] #number column, 0 by default
-- @field [parent=#cartesianDiagramInstance] @{geometry#(rectangle)} rect, minimal rectangle by default
local C={row=0,column=0,rect=geo.newRectangle(0,0,0,0)}
--- Create a new cartesianDiagram with a specfic number of row and column for each quadrants
-- @function [parent=#cartesianDiagram] newCartesianDiagram
-- @param #number row
-- @param #number column
-- @param @{geometry#(rectangle)} rect
-- @return #cartesianDiagram the created rectangle
function M.newCartesianDiagram(row, column, rect)
local newCartesianDiagram = {row=row,column=column, rect=rect}
-- set to new cartesianDiagramInstance properties of a cartesianDiagramInstance
setmetatable(newCartesianDiagram, {__index = R})
return newCartesianDiagram
end
return M;
Here's I'm not 100% sure if I use the #type annotation correctly for "cartesianDiagramInstance", but so far if I try something http://i.imgur.com/mJZ0b6T.png, well as you can see, the sugestion are messed up. He doesn't recognize the http://i.imgur.com/Nu4tv8y.png either.
In this sample, the only way to get the autocomplete kinda right, is to remove the cartesianDiagramInstance luadoc http://i.imgur.com/Nu4tv8y.png, because I use rect=geo.newRectangle(0,0,0,0) instead of nil.
So I guess it's a bug with the http://wiki.eclipse.org/Koneki/LDT/Technical_Documentation/Documentation_Language#Short_references?
|
|
|
Re: Limited autocomplete issue [message #1417010 is a reply to message #1417009] |
Wed, 13 November 2013 14:52 |
Simon Bernard Messages: 345 Registered: July 2009 |
Senior Member |
|
|
hi,
The short reference is used to reference a types and their fields in a textual description.
If you want to type fields, parameters, return values ... you should use http://wiki.eclipse.org/Koneki/LDT/Technical_Documentation/Documentation_Language#Type_references notation.
So the right way to write your code is :
--- A Cartesian Diagram
--@module cartesianDiagram
local geo=require("geometry");
M={}
--- A Cartesian Diagram Instance
-- @type cartesianDiagramInstance
-- @field #number row, 0 by default
-- @field #number column, 0 by default
-- @field geometry#rectangle rect, minimal rectangle by default
local C={row=0,column=0,rect=geo.newRectangle(0,0,0,0)}
--- Create a new cartesianDiagram with a specfic number of row and column for each quadrants
-- @function [parent=#cartesianDiagram] newCartesianDiagram
-- @param #number row
-- @param #number column
-- @param geometry#rectangle rect
-- @return #cartesianDiagramInstance the created rectangle
function M.newCartesianDiagram(row, column, rect)
local newCartesianDiagram = {row=row,column=column, rect=rect}
-- set to new cartesianDiagramInstance properties of a cartesianDiagramInstance
setmetatable(newCartesianDiagram, {__index = R})
return newCartesianDiagram
end
return M;
But rect is still not recognize because you find a new bug :).
(I just open https://bugs.eclipse.org/bugs/show_bug.cgi?id=421625)
1 remarks : "@function [parent=#cartesianDiagram] newCartesianDiagram" is now optional because we can guess the name and the parent function from code.
Thx again for your feedback :), that's really help.
|
|
| | | |
Goto Forum:
Current Time: Sat Apr 20 08:29:28 GMT 2024
Powered by FUDForum. Page generated in 0.03659 seconds
|