News:

The new Release 25.03 is out! You can download binaries for Windows and many major Linux distros here .

Main Menu

Patch for calltip, support preprocessor

Started by Loaden, April 19, 2010, 03:50:41 PM

Previous topic - Next topic

Loaden

Index: src/plugins/codecompletion/nativeparser.cpp

===================================================================

--- src/plugins/codecompletion/nativeparser.cpp (revision 6203)

+++ src/plugins/codecompletion/nativeparser.cpp (working copy)

@@ -1033,7 +1033,7 @@

         }
         if (!end)
             break;
-        lineText.Remove(end);
+        lineText.Remove(end).Trim(false);
//        Manager::Get()->GetLogManager()->DebugLog(_T("Sending \"%s\" for call-tip"), lineText.c_str());

         TokensTree* tokens = m_Parser.GetTokens();
@@ -1048,8 +1048,14 @@

         ParseLocalBlock(ed);

         m_GettingCalltips = true;
+
+        Token* tk = tokens->at(tokens->TokenExists(lineText, -1, tkPreprocessor));
+        if (tk != NULL)
+            lineText = tk->m_Type;
+
         if (!AI(result, ed, lineText, true, true, &search_scope))
             break;
+
         for (TokenIdxSet::iterator it = result.begin(); it != result.end(); ++it)
         {
             Token* token = tokens->at(*it);



[attachment deleted by admin]

ollydbg

Nice!! A lot of works by you in these days.
Many patches to improve Codeblocks.
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Loaden

Here are little modify for support global namespace.
Index: src/plugins/codecompletion/nativeparser.cpp
===================================================================
--- src/plugins/codecompletion/nativeparser.cpp (revision 6203)
+++ src/plugins/codecompletion/nativeparser.cpp (working copy)
@@ -1033,7 +1033,9 @@
         }
         if (!end)
             break;
-        lineText.Remove(end);
+        lineText.Remove(end).Trim(false);
+        if (lineText.StartsWith(_T("::")))
+            lineText = lineText.Right(lineText.Length() - 2);
//        Manager::Get()->GetLogManager()->DebugLog(_T("Sending \"%s\" for call-tip"), lineText.c_str());

         TokensTree* tokens = m_Parser.GetTokens();
@@ -1048,8 +1050,14 @@
         ParseLocalBlock(ed);

         m_GettingCalltips = true;
+
+        Token* tk = tokens->at(tokens->TokenExists(lineText, -1, tkPreprocessor));
+        if (tk != NULL)
+            lineText = tk->m_Type;
+
         if (!AI(result, ed, lineText, true, true, &search_scope))
             break;
+
         for (TokenIdxSet::iterator it = result.begin(); it != result.end(); ++it)
         {
             Token* token = tokens->at(*it);