Author: fejj
Date: 2007-03-16 16:50:24 -0500 (Fri, 16 Mar 2007)
New Revision: 74502
Modified:
trunk/monodevelop/Extras/CSharpBinding/ChangeLog
trunk/monodevelop/Extras/CSharpBinding/Gui/OverrideCompletionData.cs
Log:
2007-03-16 Jeffrey Stedfast <[EMAIL PROTECTED]>
* Gui/OverrideCompletionData.cs (InsertMethod, InsertProperty):
(InsertEvent, InsertIndexer): Use spaces rather than tabs for
indenting when appropriate. Fixes bug #81168.
Modified: trunk/monodevelop/Extras/CSharpBinding/ChangeLog
===================================================================
--- trunk/monodevelop/Extras/CSharpBinding/ChangeLog 2007-03-16 21:47:39 UTC
(rev 74501)
+++ trunk/monodevelop/Extras/CSharpBinding/ChangeLog 2007-03-16 21:50:24 UTC
(rev 74502)
@@ -1,5 +1,9 @@
2007-03-16 Jeffrey Stedfast <[EMAIL PROTECTED]>
+ * Gui/OverrideCompletionData.cs (InsertMethod, InsertProperty):
+ (InsertEvent, InsertIndexer): Use spaces rather than tabs for
+ indenting when appropriate. Fixes bug #81168.
+
* Gui/CSharpTextEditorExtension.cs (GetDirectiveCompletionData):
Add #pragma to the directives. Fixes bug #81131.
Modified: trunk/monodevelop/Extras/CSharpBinding/Gui/OverrideCompletionData.cs
===================================================================
--- trunk/monodevelop/Extras/CSharpBinding/Gui/OverrideCompletionData.cs
2007-03-16 21:47:39 UTC (rev 74501)
+++ trunk/monodevelop/Extras/CSharpBinding/Gui/OverrideCompletionData.cs
2007-03-16 21:50:24 UTC (rev 74502)
@@ -5,6 +5,7 @@
using MonoDevelop.Ide.Gui.Content;
using MonoDevelop.Projects.Parser;
using MonoDevelop.Projects.Gui.Completion;
+using MonoDevelop.SourceEditor.Properties;
using CSharpBinding.Parser;
using MonoDevelop.Projects.Ambience;
using Ambience_ = MonoDevelop.Projects.Ambience.Ambience;
@@ -84,12 +85,27 @@
void InsertMethod (IMethod method, string modifiers)
{
ConversionFlags flags =
ConversionFlags.ShowParameterNames | ConversionFlags.ShowGenericParameters;
-
- string text = modifiers + ambience.Convert (method,
flags);
- text += "\n" + indent + "{\n" + indent + "\t";
- int cpos = insertOffset + text.Length;
- text += "\n" + indent + "}\n";
+ StringBuilder textBuilder = new StringBuilder ();
+ textBuilder.Append (modifiers);
+ textBuilder.Append (ambience.Convert (method, flags));
+ textBuilder.Append ('\n');
+ textBuilder.Append (indent);
+ textBuilder.Append ("{\n");
+ textBuilder.Append (indent);
+ if (TextEditorProperties.ConvertTabsToSpaces)
+ textBuilder.Append (' ',
TextEditorProperties.TabIndent);
+ else
+ textBuilder.Append ('\t');
+
+ int cpos = insertOffset + textBuilder.Length;
+
+ textBuilder.Append ('\n');
+ textBuilder.Append (indent);
+ textBuilder.Append ("}\n");
+
+ string text = textBuilder.ToString ();
+
editor.InsertText (insertOffset, text);
editor.CursorPosition = cpos;
editor.Select (cpos, cpos);
@@ -98,23 +114,49 @@
void InsertProperty (IProperty prop, string modifiers)
{
ConversionFlags flags =
ConversionFlags.ShowParameterNames | ConversionFlags.ShowGenericParameters;
+ StringBuilder textBuilder = new StringBuilder ();
int cpos = -1;
- string text = modifiers + ambience.Convert
(prop.ReturnType, flags) + " " + prop.Name + " {\n";
+ textBuilder.Append (modifiers);
+ textBuilder.Append (ambience.Convert (prop.ReturnType,
flags));
+ textBuilder.Append (' ');
+ textBuilder.Append (prop.Name);
+ textBuilder.Append (" {\n");
+
if (prop.CanGet) {
- text += indent + "\tget { ";
- cpos = insertOffset + text.Length;
- text += " }\n";
+ textBuilder.Append (indent);
+ if (TextEditorProperties.ConvertTabsToSpaces)
+ textBuilder.Append (' ',
TextEditorProperties.TabIndent);
+ else
+ textBuilder.Append ('\t');
+
+ textBuilder.Append ("get { ");
+
+ cpos = insertOffset + textBuilder.Length;
+
+ textBuilder.Append (" }\n");
}
+
if (prop.CanSet) {
- text += indent + "\tset { ";
+ textBuilder.Append (indent);
+ if (TextEditorProperties.ConvertTabsToSpaces)
+ textBuilder.Append (' ',
TextEditorProperties.TabIndent);
+ else
+ textBuilder.Append ('\t');
+
+ textBuilder.Append ("set { ");
+
if (!prop.CanGet)
- cpos = insertOffset + text.Length;
- text += " }\n";
+ cpos = insertOffset +
textBuilder.Length;
+
+ textBuilder.Append (" }\n");
}
- text += indent + "}\n";
+ textBuilder.Append (indent);
+ textBuilder.Append ("}\n");
+ string text = textBuilder.ToString ();
+
editor.InsertText (insertOffset, text);
editor.CursorPosition = cpos;
editor.Select (cpos, cpos);
@@ -123,17 +165,38 @@
void InsertEvent (IEvent ev, string modifiers)
{
ConversionFlags flags =
ConversionFlags.ShowParameterNames | ConversionFlags.ShowGenericParameters;
- string text = modifiers + "event " + ambience.Convert
(ev.ReturnType, flags) + " " + ev.Name + " {\n";
+ StringBuilder textBuilder = new StringBuilder ();
- int cpos;
- text += indent + "\tadd { ";
- cpos = insertOffset + text.Length;
- text += " }\n";
- text += indent + "\tremove { ";
- text += " }\n";
+ textBuilder.Append (modifiers);
+ textBuilder.Append ("event ");
+ textBuilder.Append (ambience.Convert (ev.ReturnType,
flags));
+ textBuilder.Append (' ');
+ textBuilder.Append (ev.Name);
+ textBuilder.Append (" {\n");
- text += indent + "}\n";
+ textBuilder.Append (indent);
+ if (TextEditorProperties.ConvertTabsToSpaces)
+ textBuilder.Append (' ',
TextEditorProperties.TabIndent);
+ else
+ textBuilder.Append ('\t');
+ textBuilder.Append ("add { ");
+
+ int cpos = insertOffset + textBuilder.Length;
+
+ textBuilder.Append (" }\n");
+ textBuilder.Append (indent);
+ if (TextEditorProperties.ConvertTabsToSpaces)
+ textBuilder.Append (' ',
TextEditorProperties.TabIndent);
+ else
+ textBuilder.Append ('\t');
+
+ textBuilder.Append ("remove { }\n");
+ textBuilder.Append (indent);
+ textBuilder.Append ("}\n");
+
+ string text = textBuilder.ToString ();
+
editor.InsertText (insertOffset, text);
editor.CursorPosition = cpos;
editor.Select (cpos, cpos);
@@ -142,20 +205,41 @@
void InsertIndexer (IIndexer indexer, string modifiers)
{
ConversionFlags flags =
ConversionFlags.ShowParameterNames | ConversionFlags.ShowGenericParameters;
+ StringBuilder textBuilder = new StringBuilder ();
- int cpos;
+ textBuilder.Append (modifiers);
+ textBuilder.Append (ambience.Convert
(indexer.ReturnType));
+ textBuilder.Append (" this [");
- StringBuilder sb = new StringBuilder ();
- sb.Append (modifiers).Append (ambience.Convert
(indexer.ReturnType)).Append (" this [");
- ambience.Convert (indexer.Parameters, sb, flags);
- sb.Append ("] {\n");
- sb.Append (indent).Append ("\tget { ");
- cpos = insertOffset + sb.Length;
- sb.Append (" }\n");
- sb.Append (indent).Append ("\tset { ");
- sb.Append (" }\n").Append (indent).Append ("}");
+ ambience.Convert (indexer.Parameters, textBuilder,
flags);
- editor.InsertText (insertOffset, sb.ToString ());
+ textBuilder.Append ("] {\n");
+
+ textBuilder.Append (indent);
+ if (TextEditorProperties.ConvertTabsToSpaces)
+ textBuilder.Append (' ',
TextEditorProperties.TabIndent);
+ else
+ textBuilder.Append ('\t');
+
+ textBuilder.Append ("get { ");
+
+ int cpos = insertOffset + textBuilder.Length;
+
+ textBuilder.Append (" }\n");
+
+ textBuilder.Append (indent);
+ if (TextEditorProperties.ConvertTabsToSpaces)
+ textBuilder.Append (' ',
TextEditorProperties.TabIndent);
+ else
+ textBuilder.Append ('\t');
+
+ textBuilder.Append ("set { }\n");
+ textBuilder.Append (indent);
+ textBuilder.Append ("}");
+
+ string text = textBuilder.ToString ();
+
+ editor.InsertText (insertOffset, text);
editor.CursorPosition = cpos;
editor.Select (cpos, cpos);
}
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches