User forums > Using Code::Blocks

Can code completion be made contextual?

<< < (4/5) > >>

p2rkw:

--- Quote ---When you tried sorting, did you also have to modify Scintilla to allow non-alphabetical ordering?
--- End quote ---
No, I didn't.
Take a look at CodeCompletion::CodeComplete: tokens' indices generated by m_NativeParser.MarkItemsByAI() are stored in separate list called m_AutocompNameIdx. In my implementation this list wasn't sorted only by tokens name but also by other token properties.


--- Quote ---you get 16 suggestions for append() (and Append()), one for each function overload.  Is this intended behaviour?
--- End quote ---
Yes, it is. Overloaded functions can have different arguments, return value and documentation, so in my opinion they should be displayed as separated items.
But as you can see you can easily change this behaviour.

Wait a sec, I'll generate patch, so you will be able to test it.

p2rkw:
Attached patch is bit dirty because you can change sort criteria only in code, but you can see the idea.
I tell you more: you can even use different criteria in different cases, for example you can detect is autocomplete was opened in global scope and apply different criteria.

Alpha:

--- Quote from: p2rkw on March 10, 2013, 10:29:49 pm ---Overloaded functions can have different arguments, return value and documentation, so in my opinion they should be displayed as separated items.

--- End quote ---
Maybe a more optimal way would be to only show overloads as separate items if you are in global scope and function argument completion is enabled.
The documentation window could have a link to each of the overloads, and by default, show the overload with the most documentation first.


--- Quote from: p2rkw on March 10, 2013, 10:29:49 pm ---
--- Quote ---When you tried sorting, did you also have to modify Scintilla to allow non-alphabetical ordering?
--- End quote ---
No, I didn't.

--- End quote ---
I see.  The autocomp list jumps the selection as you type by searching the list for the given context with a binary search.  If the list is not alphabetized, the popup will often auto-cancel itself because it cannot find an entry (even though the entry exists).  (I had just been curious to see if you had come up with a cleaner solution than mine.)

Alpha:

--- Quote from: Alpha on March 10, 2013, 06:18:17 pm ---
--- Quote from: MortenMacFly on March 10, 2013, 12:52:25 pm ---I'm afraid the last CC commit broke this. :-(

--- End quote ---
Updated.

--- End quote ---
Just thought I should mention, if you value a non-crashing Code::Blocks, do not apply this patch...

ollydbg:

--- Quote ---if you value a non-crashing Code::Blocks, do not apply this patch
--- End quote ---
Which do you think cause the crash issue? The concurrently access to the tokentree?

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version