Code::Blocks Forums

Developer forums (C::B DEVELOPMENT STRICTLY!) => Development => Topic started by: Alpha on April 14, 2014, 04:51:05 am

Title: CC type tkMacro purpose?
Post by: Alpha on April 14, 2014, 04:51:05 am
I am unsure of what the purpose of tkMacro tokens in CC is.  However, when they show up, they tend to spam the popup:
(http://www.pasteall.org/pic/show.php?id=69769)
Reducing the list to a logical set can easily be done with:
Code
Index: src/plugins/codecompletion/codecompletion.cpp
===================================================================
--- src/plugins/codecompletion/codecompletion.cpp (revision 9752)
+++ src/plugins/codecompletion/codecompletion.cpp (working copy)
@@ -968,6 +968,9 @@
                 if (preprocessorOnly && token->m_TokenKind != tkPreprocessor)
                     continue;
 
+                if (token->m_TokenKind & tkMacro && uniqueStrings.find(token->m_Name) != uniqueStrings.end())
+                    continue; // what is a "tkMacro" ??
+
                 int iidx = m_NativeParser.GetTokenKindImage(token);
                 if (alreadyRegistered.find(iidx) == alreadyRegistered.end())
                 {

But should tkMacro tokens be included in the search results in the first place?  What are they?
Title: Re: CC type tkMacro purpose?
Post by: ollydbg on April 14, 2014, 06:32:02 am
tkMacro means macro usage. (where the macros are used)
tkPreprocessor means macro definition.
I think tkMacro should be removed from the suggestion list, since there are many macros usages.

I think the "tkMacro" should be renamed to "tkMacroUsage", also, "tkPreprocessor" should be renamed to "tkMacroDefinition".
Title: Re: CC type tkMacro purpose?
Post by: ollydbg on April 22, 2014, 09:30:14 am
@Alpha:
The following 2 patches (in attachment) are what I would like to do such variable name refactoring, what's your opinion?
If no objections, I will commit them to trunk.
I think currently the CC plugin's "symbol tree" has a folder name "preprocessor" and "macro" which are quite confusing, so we need to fix them.
Title: Re: CC type tkMacro purpose?
Post by: Alpha on April 23, 2014, 04:11:03 pm
The following 2 patches (in attachment) are what I would like to do such variable name refactoring, what's your opinion?
I personally prefer the name changes: tkMacro -> tkMacroUse and tkPreprocessor-> tkMacroDef to avoid excess verbosity.  Other than that, I think the changes are fine.
Title: Re: CC type tkMacro purpose?
Post by: ollydbg on April 24, 2014, 08:07:39 am
The following 2 patches (in attachment) are what I would like to do such variable name refactoring, what's your opinion?
I personally prefer the name changes: tkMacro -> tkMacroUse and tkPreprocessor-> tkMacroDef to avoid excess verbosity.  Other than that, I think the changes are fine.
Thanks, just follow your advice, and done in trunk rev 9757.

Now, one task left is to change the png file names associated with the new variable names, but I'm not sure git-svn can handle all those changes.  ;)

Code
preproc.png
preproc_folder.png
macro.png
macro_private.png
macro_protected.png
macro_public.png
macro_folder.png

Such as:  "preproc.png" to "macro_def.png";  "macro.png" to "macro_use.png", let me do it right now, If failed, I will report and seek help.

EDIT: image file name change is in r9758 now.