diff --git a/CodeCompletion/DomSyntaxTreeVisitor.cs b/CodeCompletion/DomSyntaxTreeVisitor.cs index 5681962df..eedd1e611 100644 --- a/CodeCompletion/DomSyntaxTreeVisitor.cs +++ b/CodeCompletion/DomSyntaxTreeVisitor.cs @@ -666,7 +666,8 @@ namespace CodeCompletion _indexer.dereferencing_value.visit(this); if (returned_scope != null && returned_scope is TypeScope) { - if ((returned_scope as TypeScope).GetFullName() != null && (returned_scope as TypeScope).GetFullName().IndexOf("System.Tuple") == 0) + TypeScope ts = returned_scope as TypeScope; + if (ts.GetFullName() != null && (ts.GetFullName().IndexOf("System.Tuple") == 0 || ts.original_type != null && ts.original_type.GetFullName() != null && ts.original_type.GetFullName().IndexOf("(T1,") == 0)) { if (_indexer.indexes.expressions[0] is int32_const) { diff --git a/CodeCompletion/ExpressionVisitor.cs b/CodeCompletion/ExpressionVisitor.cs index 4e1548f83..e179f5b53 100644 --- a/CodeCompletion/ExpressionVisitor.cs +++ b/CodeCompletion/ExpressionVisitor.cs @@ -478,6 +478,27 @@ namespace CodeCompletion returned_scope = new ElementScope(((returned_scope as ElementScope).sc as ProcScope).return_type.GetElementType()); else if (returned_scope is ProcScope && (returned_scope as ProcScope).is_constructor) returned_scope = new ElementScope((returned_scope as ProcScope).declaringType.GetElementType()); + else if (returned_scope is ElementScope && (returned_scope as ElementScope).sc is TypeScope) + { + TypeScope ts = (returned_scope as ElementScope).sc as TypeScope; + if (ts.GetFullName() != null && (ts.GetFullName().IndexOf("System.Tuple") == 0 || ts.original_type != null && ts.original_type.GetFullName() != null && ts.original_type.GetFullName().IndexOf("(T1,") == 0)) + { + if (_indexer.indexes.expressions[0] is int32_const) + { + if ((_indexer.indexes.expressions[0] as int32_const).val >= 0) + { + dot_node dn = new dot_node(_indexer.dereferencing_value, new ident("Item" + ((_indexer.indexes.expressions[0] as int32_const).val + 1))); + dn.visit(this); + } + else + returned_scope = null; + } + else + returned_scope = null; + } + else + returned_scope = new ElementScope(returned_scope.GetElementType()); + } else returned_scope = new ElementScope(returned_scope.GetElementType()); } diff --git a/TestSuite/intellisense_tests/tuple7.pas b/TestSuite/intellisense_tests/tuple7.pas new file mode 100644 index 000000000..46ab76dcb --- /dev/null +++ b/TestSuite/intellisense_tests/tuple7.pas @@ -0,0 +1,5 @@ +begin + var t := (1,1.2); + var s{@var s: string;@} := t[0].ToString; + t[1].ToString{@function real.ToString(): string; virtual;@}; +end. \ No newline at end of file