Author: lluis
Date: 2007-10-02 13:14:07 -0400 (Tue, 02 Oct 2007)
New Revision: 86759
Modified:
trunk/monodevelop/Extras/CSharpBinding/ChangeLog
trunk/monodevelop/Extras/CSharpBinding/Gui/CSharpParameterDataProvider.cs
trunk/monodevelop/Extras/CSharpBinding/Gui/CSharpTextEditorExtension.cs
Log:
* Gui/CSharpParameterDataProvider.cs, Gui/CSharpTextEditorExtension.cs:
Implemented support for the Show Parameter List command. Also, show
the parameter list when typing a comma. Fixes bug #324876.
Modified: trunk/monodevelop/Extras/CSharpBinding/ChangeLog
===================================================================
--- trunk/monodevelop/Extras/CSharpBinding/ChangeLog 2007-10-02 17:12:14 UTC
(rev 86758)
+++ trunk/monodevelop/Extras/CSharpBinding/ChangeLog 2007-10-02 17:14:07 UTC
(rev 86759)
@@ -1,3 +1,9 @@
+2007-10-02 Lluis Sanchez Gual <[EMAIL PROTECTED]>
+
+ * Gui/CSharpParameterDataProvider.cs, Gui/CSharpTextEditorExtension.cs:
+ Implemented support for the Show Parameter List command. Also, show
the
+ parameter list when typing a comma. Fixes bug #324876.
+
2007-09-21 Lluis Sanchez Gual <[EMAIL PROTECTED]>
* CSharpBinding.addin.xml: Bump MD version.
Modified:
trunk/monodevelop/Extras/CSharpBinding/Gui/CSharpParameterDataProvider.cs
===================================================================
--- trunk/monodevelop/Extras/CSharpBinding/Gui/CSharpParameterDataProvider.cs
2007-10-02 17:12:14 UTC (rev 86758)
+++ trunk/monodevelop/Extras/CSharpBinding/Gui/CSharpParameterDataProvider.cs
2007-10-02 17:14:07 UTC (rev 86759)
@@ -45,8 +45,13 @@
public override int GetCurrentParameterIndex
(ICodeCompletionContext ctx)
{
+ return GetCurrentParameterIndex (editor,
ctx.TriggerOffset);
+ }
+
+ public static int GetCurrentParameterIndex (TextEditor editor,
int triggerOffset)
+ {
int cursor = editor.CursorPosition;
- int i = ctx.TriggerOffset;
+ int i = triggerOffset;
if (i > cursor)
return -1;
Modified:
trunk/monodevelop/Extras/CSharpBinding/Gui/CSharpTextEditorExtension.cs
===================================================================
--- trunk/monodevelop/Extras/CSharpBinding/Gui/CSharpTextEditorExtension.cs
2007-10-02 17:12:14 UTC (rev 86758)
+++ trunk/monodevelop/Extras/CSharpBinding/Gui/CSharpTextEditorExtension.cs
2007-10-02 17:14:07 UTC (rev 86759)
@@ -175,6 +175,11 @@
string newIndent;
char ch, c;
+ if ((char)(uint)key == ',') {
+ // Parameter completion
+ RunParameterCompletionCommand ();
+ }
+
// This code is for Smart Indent, no-op for any other
indent style
if (TextEditorProperties.IndentStyle !=
IndentStyle.Smart)
return base.KeyPress (key, modifier);
@@ -485,11 +490,12 @@
{
if (completionChar == '(') {
IParserContext pctx = GetParserContext ();
+ int curPos = completionContext.TriggerOffset;
// Get the text from the begining of the line
int lin, col;
- Editor.GetLineColumnFromPosition
(Editor.CursorPosition, out lin, out col);
- string textToCursor = Editor.GetText (0,
Editor.CursorPosition - 1);
+ Editor.GetLineColumnFromPosition (curPos, out
lin, out col);
+ string textToCursor = Editor.GetText (0, curPos
- 1);
// Find the expression before the '('
ExpressionFinder expressionFinder = new
ExpressionFinder (null);
@@ -499,7 +505,7 @@
// This is a bit of a hack, but for the
resolver to properly resolve a constructor
// call needs the new keyword and the brackets,
so let's provide them
- int i = Editor.CursorPosition - 2 - ex.Length;
+ int i = curPos - 2 - ex.Length;
if (GetPreviousToken ("new", ref i, true))
ex = "new " + ex + "()";
@@ -532,6 +538,24 @@
return null;
}
+ public override bool GetParameterCompletionCommandOffset (out
int cpos)
+ {
+ cpos = Editor.CursorPosition - 1;
+ while (cpos > 0) {
+ char c = Editor.GetCharAt (cpos);
+ if (c == '(') {
+ int p =
CSharpParameterDataProvider.GetCurrentParameterIndex (Editor, cpos + 1);
+ if (p != -1) {
+ cpos++;
+ return true;
+ }
+ }
+ cpos--;
+ }
+ return false;
+ }
+
+
bool IsInsideDocumentationComment (int cursor)
{
int lin, col;
@@ -551,7 +575,7 @@
// Xml documentation code completion.
if (charTyped == '<' && IsInsideDocumentationComment
(Editor.CursorPosition))
return GetXmlDocumentationCompletionData ();
-
+
if (charTyped != '.' && charTyped != ' ')
return null;
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches