Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » Lua Development Tools » Limited autocomplete issue(@return statement doesn't seem to work)
Limited autocomplete issue [message #1113893] Sat, 21 September 2013 22:39 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 documentation:

--- 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 #1114855 is a reply to message #1113893] 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 #1141440 is a reply to message #1113893] 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 Smile 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 #1184360 is a reply to message #1141440] 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 = C})
  return newCartesianDiagram
end

return M;


Here's I'm not 100% sure if I used the #type annotation correctly for "cartesianDiagramInstance", but so far if I tried something like this and as you can see, the sugestions are messed up. He doesn't recognize the "rect" field either.

In this sample, the only way to get the autocomplete kinda right, is to remove the cartesianDiagramInstance luadoc like this, because I use rect=geo.newRectangle(0,0,0,0) instead of something like rect=nil.

So I guess it's a bug with the short references? Or did I do something wrong?

edit: Ok, I just renamed geo=require("geometry") to geometry=require("geometry")... and it seem to work now... I'll check later if there aren't any other use case missing.

[Updated on: Wed, 13 November 2013 13:26]

Report message to a moderator

Re: Limited autocomplete issue [message #1184575 is a reply to message #1184360] 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 type reference 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 Smile.
(I just open it)

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 Smile, that's really help.

Re: Limited autocomplete issue [message #1184596 is a reply to message #1184575] 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 Smile (https://bugs.eclipse.org/bugs/show_bug.cgi?id=421630)
We will fix that Smile
Re: Limited autocomplete issue [message #1184603 is a reply to message #1184596] 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 #1185940 is a reply to message #1184603] 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! Cool

I'm currently trying to make a little side project with iup and I try to make it work with MVC, so I'll definilty need to use multiple modules sooner or later.

[Updated on: Thu, 14 November 2013 11:28]

Report message to a moderator

Previous Topic:Spellcheck Support
Next Topic:Editing Syntax Coloring
Goto Forum:
  


Current Time: Thu Mar 28 22:31:09 GMT 2024

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

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

Back to the top