Author: lluis
Date: 2007-10-02 10:29:50 -0400 (Tue, 02 Oct 2007)
New Revision: 86747

Modified:
   trunk/monodevelop/Core/src/MonoDevelop.Ide/ChangeLog
   
trunk/monodevelop/Core/src/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Content/CompletionTextEditorExtension.cs
Log:
* MonoDevelop.Ide.Gui.Content/CompletionTextEditorExtension.cs: Never
  insert the namespace name of the class when completing a class from
  the ctrl+space list. Fixes bug #328804.

Modified: trunk/monodevelop/Core/src/MonoDevelop.Ide/ChangeLog
===================================================================
--- trunk/monodevelop/Core/src/MonoDevelop.Ide/ChangeLog        2007-10-02 
14:12:09 UTC (rev 86746)
+++ trunk/monodevelop/Core/src/MonoDevelop.Ide/ChangeLog        2007-10-02 
14:29:50 UTC (rev 86747)
@@ -1,3 +1,9 @@
+2007-10-02  Lluis Sanchez Gual <[EMAIL PROTECTED]> 
+
+       * MonoDevelop.Ide.Gui.Content/CompletionTextEditorExtension.cs: Never 
insert
+         the namespace name of the class when completing a class from the
+         ctrl+space list. Fixes bug #328804.
+
 2007-09-27  Lluis Sanchez Gual <[EMAIL PROTECTED]> 
 
        * MonoDevelop.Ide.Gui.Dialogs/CombineEntryFeatureSelector.cs: Make sure

Modified: 
trunk/monodevelop/Core/src/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Content/CompletionTextEditorExtension.cs
===================================================================
--- 
trunk/monodevelop/Core/src/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Content/CompletionTextEditorExtension.cs
     2007-10-02 14:12:09 UTC (rev 86746)
+++ 
trunk/monodevelop/Core/src/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Content/CompletionTextEditorExtension.cs
     2007-10-02 14:29:50 UTC (rev 86747)
@@ -193,7 +193,7 @@
                        IParserContext ctx = GetParserContext();
                        if (ctx != null) {
                                CodeCompletionDataProvider completionProvider = 
new CodeCompletionDataProvider (ctx, GetAmbience ());
-                               completionProvider.AddResolveResults 
(ctx.CtrlSpace (completionContext.TriggerLine + 1, 
completionContext.TriggerLineOffset + 1, FileName));
+                               completionProvider.AddResolveResults 
(ctx.CtrlSpace (completionContext.TriggerLine + 1, 
completionContext.TriggerLineOffset + 1, FileName), true, 
SimpleTypeNameResolver.Instance);
                                if (!completionProvider.IsEmpty)
                                        return completionProvider;
                        }
@@ -209,4 +209,22 @@
                                completionWidget.CompletionContextChanged += 
OnCompletionContextChanged;
                }
        }
+       
+       class SimpleTypeNameResolver: ITypeNameResolver
+       {
+               // This simple resolver removes the namespace from all class 
names.
+               // Used in ctrl+space, since all classes shown in the 
completion list
+               // are in scope
+               
+               public static SimpleTypeNameResolver Instance = new 
SimpleTypeNameResolver ();
+               
+               public string ResolveName (string typeName)
+               {
+                       int i = typeName.LastIndexOf ('.');
+                       if (i == -1)
+                               return typeName;
+                       else
+                               return typeName.Substring (i+1);
+               }
+       }
 }

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to