|
|
|
@ -627,6 +627,7 @@ namespace ICSharpCode.NRefactory.CSharp.Completion |
|
|
|
} |
|
|
|
} |
|
|
|
var contextList = new CompletionDataWrapper(this); |
|
|
|
var contextList = new CompletionDataWrapper(this); |
|
|
|
var identifierStart = GetExpressionAtCursor(); |
|
|
|
var identifierStart = GetExpressionAtCursor(); |
|
|
|
|
|
|
|
|
|
|
|
if (identifierStart != null) { |
|
|
|
if (identifierStart != null) { |
|
|
|
if (identifierStart.Node is TypeParameterDeclaration) { |
|
|
|
if (identifierStart.Node is TypeParameterDeclaration) { |
|
|
|
return null; |
|
|
|
return null; |
|
|
|
@ -669,7 +670,6 @@ namespace ICSharpCode.NRefactory.CSharp.Completion |
|
|
|
if (!(Char.IsWhiteSpace(prevCh) || allowedChars.IndexOf(prevCh) >= 0)) { |
|
|
|
if (!(Char.IsWhiteSpace(prevCh) || allowedChars.IndexOf(prevCh) >= 0)) { |
|
|
|
return null; |
|
|
|
return null; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// Do not pop up completion on identifier identifier (should be handled by keyword completion).
|
|
|
|
// Do not pop up completion on identifier identifier (should be handled by keyword completion).
|
|
|
|
tokenIndex = offset - 1; |
|
|
|
tokenIndex = offset - 1; |
|
|
|
token = GetPreviousToken(ref tokenIndex, false); |
|
|
|
token = GetPreviousToken(ref tokenIndex, false); |
|
|
|
@ -688,6 +688,7 @@ namespace ICSharpCode.NRefactory.CSharp.Completion |
|
|
|
// after these always follows a name
|
|
|
|
// after these always follows a name
|
|
|
|
return null; |
|
|
|
return null; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
Console.WriteLine (1); |
|
|
|
|
|
|
|
|
|
|
|
if (identifierStart == null && !string.IsNullOrEmpty(token) && !IsInsideCommentStringOrDirective() && (prevToken2 == ";" || prevToken2 == "{" || prevToken2 == "}")) { |
|
|
|
if (identifierStart == null && !string.IsNullOrEmpty(token) && !IsInsideCommentStringOrDirective() && (prevToken2 == ";" || prevToken2 == "{" || prevToken2 == "}")) { |
|
|
|
char last = token [token.Length - 1]; |
|
|
|
char last = token [token.Length - 1]; |
|
|
|
@ -708,6 +709,7 @@ namespace ICSharpCode.NRefactory.CSharp.Completion |
|
|
|
if (n != null && n.Parent is AnonymousTypeCreateExpression) { |
|
|
|
if (n != null && n.Parent is AnonymousTypeCreateExpression) { |
|
|
|
AutoSelect = false; |
|
|
|
AutoSelect = false; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
Console.WriteLine (2); |
|
|
|
|
|
|
|
|
|
|
|
// Handle foreach (type name _
|
|
|
|
// Handle foreach (type name _
|
|
|
|
if (n is IdentifierExpression) { |
|
|
|
if (n is IdentifierExpression) { |
|
|
|
@ -719,24 +721,10 @@ namespace ICSharpCode.NRefactory.CSharp.Completion |
|
|
|
} |
|
|
|
} |
|
|
|
return null; |
|
|
|
return null; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// var astResolver = new CSharpAstResolver(
|
|
|
|
|
|
|
|
// GetState(),
|
|
|
|
|
|
|
|
// identifierStart.Unit,
|
|
|
|
|
|
|
|
// CSharpUnresolvedFile
|
|
|
|
|
|
|
|
// );
|
|
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
// foreach (var type in CreateFieldAction.GetValidTypes(astResolver, (Expression)n)) {
|
|
|
|
|
|
|
|
// if (type.Kind == TypeKind.Delegate) {
|
|
|
|
|
|
|
|
// AddDelegateHandlers(contextList, type, false, false);
|
|
|
|
|
|
|
|
// AutoSelect = false;
|
|
|
|
|
|
|
|
// AutoCompleteEmptyMatch = false;
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// Handle object/enumerable initialzer expressions: "new O () { P$"
|
|
|
|
// Handle object/enumerable initialzer expressions: "new O () { P$"
|
|
|
|
if (n is IdentifierExpression && n.Parent is ArrayInitializerExpression) { |
|
|
|
if (n is IdentifierExpression && n.Parent is ArrayInitializerExpression && !(n.Parent.Parent is ArrayCreateExpression)) { |
|
|
|
var result = HandleObjectInitializer(identifierStart.Unit, n); |
|
|
|
var result = HandleObjectInitializer(identifierStart.Unit, n); |
|
|
|
if (result != null) |
|
|
|
if (result != null) |
|
|
|
return result; |
|
|
|
return result; |
|
|
|
@ -777,6 +765,7 @@ namespace ICSharpCode.NRefactory.CSharp.Completion |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
Console.WriteLine (3); |
|
|
|
|
|
|
|
|
|
|
|
if (n != null && n.Parent is ObjectCreateExpression) { |
|
|
|
if (n != null && n.Parent is ObjectCreateExpression) { |
|
|
|
var invokeResult = ResolveExpression(n.Parent); |
|
|
|
var invokeResult = ResolveExpression(n.Parent); |
|
|
|
@ -2026,10 +2015,10 @@ namespace ICSharpCode.NRefactory.CSharp.Completion |
|
|
|
sb.Append(", "); |
|
|
|
sb.Append(", "); |
|
|
|
sbWithoutTypes.Append(", "); |
|
|
|
sbWithoutTypes.Append(", "); |
|
|
|
} |
|
|
|
} |
|
|
|
var convertedParameter = builder.ConvertParameter (delegateMethod.Parameters [k]); |
|
|
|
var convertedParameter = builder.ConvertParameter(delegateMethod.Parameters [k]); |
|
|
|
if (convertedParameter.ParameterModifier == ParameterModifier.Params) |
|
|
|
if (convertedParameter.ParameterModifier == ParameterModifier.Params) |
|
|
|
convertedParameter.ParameterModifier = ParameterModifier.None; |
|
|
|
convertedParameter.ParameterModifier = ParameterModifier.None; |
|
|
|
sb.Append(convertedParameter.GetText (FormattingPolicy)); |
|
|
|
sb.Append(convertedParameter.GetText(FormattingPolicy)); |
|
|
|
sbWithoutTypes.Append(delegateMethod.Parameters [k].Name); |
|
|
|
sbWithoutTypes.Append(delegateMethod.Parameters [k].Name); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@ -2049,7 +2038,7 @@ namespace ICSharpCode.NRefactory.CSharp.Completion |
|
|
|
); |
|
|
|
); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (!delegateMethod.Parameters.Any (p => p.IsOut || p.IsRef) && !completionList.Result.Any(data => data.DisplayText == sbWithoutTypes.ToString())) { |
|
|
|
if (!delegateMethod.Parameters.Any(p => p.IsOut || p.IsRef) && !completionList.Result.Any(data => data.DisplayText == sbWithoutTypes.ToString())) { |
|
|
|
completionList.AddCustom( |
|
|
|
completionList.AddCustom( |
|
|
|
sbWithoutTypes.ToString(), |
|
|
|
sbWithoutTypes.ToString(), |
|
|
|
"Creates lambda expression.", |
|
|
|
"Creates lambda expression.", |
|
|
|
|