Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » Koneki » Limited autocomplete issue
Limited autocomplete issue [message #1416978] Sun, 22 September 2013 02:51 Go to next message
anto gerva is currently offline anto gervaFriend
Messages: 19
Registered: June 2012
Location: Canada, Québec
Junior Member
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 #1416979 is a reply to message #1416978] Mon, 23 September 2013 09:59 Go to previous messageGo to next message
Simon Bernard is currently offline Simon BernardFriend
Messages: 345
Registered: July 2009
Senior Member
Hi,
The first one looks like a bug. I just test it and it does not work for me too. If you use local variable it should work.


local geo=require('geometry');
local myRectangle = geo.newRectangle(1,1,1,1); --autocomplete work fine here
myRectangle. --??? autocomplete doesn't work anymore


The second one is not implemented. Currently, after a function call we are not able to propose autocompletion.

I open 2 bugs.
https://bugs.eclipse.org/bugs/show_bug.cgi?id=417793
https://bugs.eclipse.org/bugs/show_bug.cgi?id=417792
Re: Limited autocomplete issue [message #1416984 is a reply to message #1416978] Thu, 17 October 2013 02:21 Go to previous messageGo to next message
anto gerva is currently offline anto gervaFriend
Messages: 19
Registered: June 2012
Location: Canada, Québec
Junior Member
Nice :) I'll be looking foward for these feature.
I just saw the new branch poping up for it, keep up the good work!

Merci
Re: Limited autocomplete issue [message #1417009 is a reply to message #1416984] Wed, 13 November 2013 11:49 Go to previous messageGo to next message
anto gerva is currently offline anto gervaFriend
Messages: 19
Registered: June 2012
Location: Canada, Québec
Junior Member
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 Go to previous messageGo to next message
Simon Bernard is currently offline Simon BernardFriend
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.
Re: Limited autocomplete issue [message #1417011 is a reply to message #1417010] Wed, 13 November 2013 15:10 Go to previous messageGo to next message
Simon Bernard is currently offline Simon BernardFriend
Messages: 345
Registered: July 2009
Senior Member
It seems you found not one but two bugs :) (https://bugs.eclipse.org/bugs/show_bug.cgi?id=421630)
We will fix that :)
Re: Limited autocomplete issue [message #1417012 is a reply to message #1417011] Wed, 13 November 2013 15:12 Go to previous messageGo to next message
Simon Bernard is currently offline Simon BernardFriend
Messages: 345
Registered: July 2009
Senior Member
(Ok I must stop with smiley ...)
Re: Limited autocomplete issue [message #1417013 is a reply to message #1417012] Thu, 14 November 2013 11:15 Go to previous message
anto gerva is currently offline anto gervaFriend
Messages: 19
Registered: June 2012
Location: Canada, Québec
Junior Member
Hehe, nice then, I'll definitly look foward for this fix!

Also there an annoying issue that I can think of. Basicly, Lua allow multiple return in a module like:

local M={}
local C={}

return M,C;
Previous Topic:Spellcheck Support
Next Topic:Editing Syntax Coloring
Goto Forum:
  


Current Time: Tue Apr 16 05:18:08 GMT 2024

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

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

Back to the top