User forums > Using Code::Blocks
Can code completion be made contextual?
Alpha:
--- Quote from: ollydbg on July 07, 2012, 01:28:56 am ---If a Token is a local variable(automatic variable), it will have Token->m_IsTemp==true.
So, maybe, we can firstly scan those tokens, and put them in the beginning of the codecompletion list.
--- End quote ---
This is possible, but requires modification to Scintilla (pending).
(I got distracted from my other work so...) Attached patch implements this.
p2rkw:
I implemented such feature: http://forums.codeblocks.org/index.php/topic,17146.msg119037.html#msg119037
but oBFusCATed told me that should be in separated patch so I removed this functionality.
My main goal was to sort list by item token's type, and place items with same type as expected type at top of the list.
But I didn't know how to detect expected type, so I only add criteria that was easier to implement.
Alpha:
Interesting; I must have missed that when it was last discussed. When you tried sorting, did you also have to modify Scintilla to allow non-alphabetical ordering?
One potential issue with priority sorting, is that if there are too many categories, the user will not see the names of alphabetically similar items close to each other, and may assume they do not exist.
By the way, I have tried CC with your patch (in rev. 8901), and if you type
--- Code: ---wxString::app
--- End code ---
you get 16 suggestions for append() (and Append()), one for each function overload. Is this intended behaviour?
MortenMacFly:
--- Quote from: Alpha on March 08, 2013, 11:22:59 pm ---Attached patch implements this.
--- End quote ---
I'm afraid the last CC commit broke this. :-(
Alpha:
--- Quote from: MortenMacFly on March 10, 2013, 12:52:25 pm ---I'm afraid the last CC commit broke this. :-(
--- End quote ---
Updated.
--- Quote from: Alpha on March 09, 2013, 10:02:59 pm ---By the way, I have tried CC with your patch (in rev. 8901), and if you type
--- Code: ---wxString::app
--- End code ---
you get 16 suggestions for append() (and Append()), one for each function overload. Is this intended behaviour?
--- End quote ---
src/plugins/codecompletion/codecompletion.cpp line 1012:
--- Code: --- static const bool ignoreOverloads = false;
if (ignoreOverloads)
{
// check hashmap for unique_strings
if (unique_strings.find(tmp) != unique_strings.end())
continue;
}
--- End code ---
Was this supposed to be user configurable?
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version