Developer forums (C::B DEVELOPMENT STRICTLY!) > CodeCompletion redesign
CC plugin interface redesign
Folco:
Oh my god, a documentation calltip like what I always wanted to have ! \o/ Good job :)
dmoore:
--- Quote from: Folco on November 02, 2013, 08:30:52 pm ---Oh my god, a documentation calltip like what I always wanted to have ! \o/ Good job :)
--- End quote ---
Yes. Big props to the good work by p2rkw and alpha!
Alpha:
--- Quote from: dmoore on November 02, 2013, 05:35:13 pm ---
--- Quote from: dmoore on November 02, 2013, 03:10:45 pm ---
--- Code: --- CodeBlocksEvent evt(cbEVT_COMPLETE_CODE);
Manager::Get()->GetPluginManager()->NotifyPlugins(evt);
--- End code ---
--- End quote ---
So this works, but it is a little confusing for me to say "NotifyPlugins" when I actually mean "Notify CC Manager (to notify me)"
--- End quote ---
I would recommend:
--- Code: --- CodeBlocksEvent evt(cbEVT_COMPLETE_CODE);
Manager::Get()->ProcessEvent(evt);
--- End code ---
--- Quote from: dmoore on November 02, 2013, 05:49:35 pm ---So it turns out that the old default STC behavior of appending a ? and a number e.g. "print?1" also works.
--- End quote ---
If that works, then the revision you are compiling against is out of date. Also, it is unnecessary now; instead assign the number to the (new) category member of CCToken.
--- Quote from: dmoore on November 02, 2013, 05:49:35 pm ---btw, is it expected that a plugin will need to register its own images:
--- End quote ---
Currently you will have to. I am still thinking about if there is a good way to allow plugins to register (or even share) images through CCManager.
--- Quote from: dmoore on November 02, 2013, 06:33:20 pm ---1. what do I put in hlStart, hlEnd and argsPos?
--- End quote ---
hlStart and hlEnd are: if you appended all of the strings that GetCallTips() returns, what would be the starting and ending indicies of the desired highlighted range.
--- Quote from: dmoore on November 02, 2013, 06:33:20 pm ---2. The active calltip is getting automatically hidden after less than second. Any idea why this might be happening?
--- End quote ---
You must put a location in argsPos which represents the starting position (in the stc) of the arguments, for example the argsPos for when the cursor is anywhere inside GetCallTips() - but not inside GetStyleAt() - would be:
--- Code: --- const wxStringVec& tips = ccPlugin->GetCallTips(pos, stc->GetStyleAt(pos), ed, hlStart, hlEnd, argsPos);
^
--- End code ---
It is being cancelled immediately because CCManager uses the argsPos variable to determine what calltips are the same, or in the case of wxSCI_INVALID_POSITION (-1) , invalid.
--- Quote from: dmoore on November 02, 2013, 07:44:41 pm ---If you want to test the code is in svn here: http://developer.berlios.de/svn/?group_id=7745
PythonCodeComletion-cc contains the code that's compatible with your branch. I've hard-coded the links in the unix project file. I haven't tested on windows at all, so the windows project file may compile without tweaks, but no guarantee.
--- End quote ---
My apologies, but it will not compile just yet, it seems I have already broken API with you. I will try to post some patches for yours, when I have time.
--- Quote from: dmoore on November 02, 2013, 09:11:40 pm ---
--- Quote from: Folco on November 02, 2013, 08:30:52 pm ---Oh my god, a documentation calltip like what I always wanted to have ! \o/ Good job :)
--- End quote ---
Yes. Big props to the good work by p2rkw and alpha!
--- End quote ---
My branch has mostly just migrated the code p2rkw wrote. (Display logic in my branch is slightly different, and *hopefully* acts a little more stable.)
dmoore:
--- Quote from: Alpha on November 02, 2013, 09:17:42 pm ---
--- Quote from: dmoore on November 02, 2013, 05:49:35 pm ---So it turns out that the old default STC behavior of appending a ? and a number e.g. "print?1" also works.
--- End quote ---
If that works, then the revision you are compiling against is out of date. Also, it is unnecessary now; instead assign the number to the (new) category member of CCToken.
--- End quote ---
But is there any good reason not to support the stc method? The stc control wants the symbol?category syntax so why not just support that?
--- Quote ---
--- Quote from: dmoore on November 02, 2013, 05:49:35 pm ---btw, is it expected that a plugin will need to register its own images:
--- End quote ---
Currently you will have to. I am still thinking about if there is a good way to allow plugins to register (or even share) images through CCManager.
--- End quote ---
It is probably fine as is, but it won't be obvious for someone using the API for the first time, so include some docs somewhere.
--- Quote ---
--- Quote from: dmoore on November 02, 2013, 06:33:20 pm ---1. what do I put in hlStart, hlEnd and argsPos?
--- End quote ---
hlStart and hlEnd are: if you appended all of the strings that GetCallTips() returns, what would be the starting and ending indicies of the desired highlighted range.
--- End quote ---
Can you give an example of what you mean? The array represents the multiple matching calls or the args?
--- Quote ---
--- Quote from: dmoore on November 02, 2013, 06:33:20 pm ---2. The active calltip is getting automatically hidden after less than second. Any idea why this might be happening?
--- End quote ---
You must put a location in argsPos which represents the starting position (in the stc) of the arguments, for example the argsPos for when the cursor is anywhere inside GetCallTips() - but not inside GetStyleAt() - would be:
--- Code: --- const wxStringVec& tips = ccPlugin->GetCallTips(pos, stc->GetStyleAt(pos), ed, hlStart, hlEnd, argsPos);
^
--- End code ---
--- End quote ---
So argsPos is always the stc position of the opening brace?
What if the user presses "," but the cursor is not in a function call (e.g. python tuple or list)? Will GetCallTip be called and should the plugin return nothing?
--- Quote ---
--- Quote from: dmoore on November 02, 2013, 07:44:41 pm ---If you want to test the code is in svn here: http://developer.berlios.de/svn/?group_id=7745
PythonCodeComletion-cc contains the code that's compatible with your branch. I've hard-coded the links in the unix project file. I haven't tested on windows at all, so the windows project file may compile without tweaks, but no guarantee.
--- End quote ---
My apologies, but it will not compile just yet, it seems I have already broken API with you. I will try to post some patches for yours, when I have time.
--- End quote ---
No need to - use the time to create doc strings :). I should be able to keep up with your changes.
dmoore:
There was only a small change needed to compile against your changes, but now there are other problems...
--- Code: ---PythonCodeCompletion::CCProviderStatus PythonCodeCompletion::GetProviderStatusFor(cbEditor* ed)
{
Manager::Get()->GetLogManager()->Log(_("PYCC: Provider status check"));
if (ed->GetLanguage() == ed->GetColourSet()->GetHighlightLanguage(wxSCI_LEX_PYTHON))
return ccpsActive;
if (ed->GetControl()->GetLexer()==wxSCI_LEX_PYTHON)
return ccpsActive;
Manager::Get()->GetLogManager()->Log(_("PYCC: Provider status check INACTIVE"));
return ccpsInactive;
}
--- End code ---
Neither of those checks return true because it seems that the call occurs before the lexer is set. Also, how will you handle the case where the user changes the highlight language to something else? It looks like your code only checks once for each editor, no? What was wrong with the old mechanism? Surely it wasn't that inefficient to ping a few plugins before each call? (I don't mind you changing as long as it works!)
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version