Code completion - missing features? [message #1783330] |
Mon, 12 March 2018 02:58  |
Eclipse User |
|
|
|
Let us assume I have a class framework. This framework ensures that I get some private variable space.
cmr.class("myclass").func("myfunc",
function(self, clazz, privates, myarg)
-- do whatever I like
end)
For code completion I can use doc:
------
-- @type myclass
cmr.class("myclass").func("myfunc",
------
-- @function [parent=#myclass] myfunc
-- @param #myclass self
-- @param clazz#clazz clazz
-- @param #myprivates privates
-- @param #number myarg
function(self, clazz, privates, myarg)
privates.| -- code completion works here
end)
My problem ist code completion if I use this class.
f.e.:
local foo = cmr.new("myclass") -- #myclass
foo:myfunc| -- code completion at this Point
Eclipse shows me the "internal" function signature. Self parameter is ok, but it shows me three parameters (clazz, privates, myarg). Of Course this is what I described in doc. Is there some way to hide parameters "clazz" and "privates"? If I simply remove them from doc it works but the code completion inside my function does not work :-(
------
-- @type myclass
cmr.class("myclass").func("myfunc",
------
-- @function [parent=#myclass] myfunc
-- @param #myclass self
-- @param #number myarg
function(self, clazz, privates, myarg)
privates.| -- code completion does not work here becuase it does not know which type privates should be
end)
|
|
|
|
Re: Code completion - missing features? [message #1783360 is a reply to message #1783330] |
Mon, 12 March 2018 07:42   |
Eclipse User |
|
|
|
Quote:to declare privates parameters for a function.
Excactly.
Quote:how users could use your function ?
Technically the helper "cmr" builds wrappers around the functions.
So from public view you will invoke the first method declaration (without clazz and privates Parameter) but the function itself has to see ist privates.
Simple "real life" example:
cmr.class("myaccount").ctor(function(self, clazz, privates, initial)
privates.balance = initial
end)
.func("add", function(self, clazz, privates, difference)
privates.balance = privates.balance + difference
end)
.func("print", function(self, clazz, privates, difference)
print(privates.balance)
end)
local account1 = cmr.new("myaccount", 1000)
account1:add(500)
account1:print() -- prints "1500"
print(account1.balance) -- prints "nil", no way to manipulate the private Balance variable
Actually it works but now I look for a way to hide the Parameters during code completion. So that eclipse does not Show me the clazz and private Parameter because as API user I do not know about them and do not want to pass them to the function :-)
[Updated on: Mon, 12 March 2018 07:50] by Moderator
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03336 seconds