View Issue Details

IDProjectCategoryView StatusLast Update
0018416PatchesIDEpublic2011-01-24 10:34
ReporterAlexander S. KleninAssigned ToMattias Gaertner 
PrioritynormalSeveritymajorReproducibilityalways
Status closedResolutionfixed 
Product VersionProduct Build 
Target Version0.9.30Fixed in Version0.9.29 (SVN) 
Summary0018416: Auto-completion fails for indexed properties
DescriptionIf the property has an 'index' specifier, auto-completion fails
in two separate ways detailed below.
Attached patch fixes the problems.
Steps To ReproduceFirst bug:
1) Enter the following code:
type
  TCheck = class
  public
    property P: Integer index 1;
  end;
2) Press Ctrl+Shift+C
=>
'read' and 'write' specifiers are inserted in front of '1',
instead of behind it

Second bug:
1) Enter code:
type
  TCheck = class
  public
    property P: Integer index 1 read GetP;
  end;
2) Press Ctrl+Shift+C twice
=>
GetP function is inserted twice, not once
TagsNo tags attached.
Fixed in Revision
LazTarget-
Widgetset
Attached Files
  • competion_indexed.patch (2,088 bytes)
    Index: codecompletiontool.pas
    ===================================================================
    --- codecompletiontool.pas	(revision 28873)
    +++ codecompletiontool.pas	(working copy)
    @@ -5353,10 +5353,10 @@
                AccessParam);
           end else begin
             // 'read' keyword does not exist -> insert behind index and type
    -        if Parts[ppIndexWord].StartPos>0 then
    +        if Parts[ppIndex].StartPos>0 then
    +          InsertPos:=Parts[ppIndex].EndPos
    +        else if Parts[ppIndexWord].StartPos>0 then
               InsertPos:=Parts[ppIndexWord].EndPos
    -        else if Parts[ppIndex].StartPos>0 then
    -          InsertPos:=Parts[ppIndex].EndPos
             else
               InsertPos:=Parts[ppType].EndPos;
             ASourceChangeCache.Replace(gtSpace,gtNone,InsertPos,InsertPos,
    @@ -5378,7 +5378,7 @@
             CleanAccessFunc:=UpperCaseStr(AccessParam)+'('+CleanParamList+');';
           end else begin
             // index + param list
    -        CleanAccessFunc:=UpperCaseStr(AccessParam)+'(:INTEGER;'
    +        CleanAccessFunc:=UpperCaseStr(AccessParam)+'(INTEGER;'
                             +CleanParamList+');';
           end;
         end else begin
    @@ -5387,7 +5387,7 @@
             CleanAccessFunc:=UpperCaseStr(AccessParam)+';';
           end else begin
             // index, no param list
    -        CleanAccessFunc:=UpperCaseStr(AccessParam)+'(:INTEGER);';
    +        CleanAccessFunc:=UpperCaseStr(AccessParam)+'(INTEGER);';
           end;
         end;
         if ProcExistsInCodeCompleteClass(CleanAccessFunc) then exit;
    @@ -5484,10 +5484,10 @@
               InsertPos:=Parts[ppRead].EndPos
             else if Parts[ppReadWord].StartPos>0 then
               InsertPos:=Parts[ppReadWord].EndPos
    +        else if Parts[ppIndex].StartPos>0 then
    +          InsertPos:=Parts[ppIndex].EndPos
             else if Parts[ppIndexWord].StartPos>0 then
               InsertPos:=Parts[ppIndexWord].EndPos
    -        else if Parts[ppIndex].StartPos>0 then
    -          InsertPos:=Parts[ppIndex].EndPos
             else
               InsertPos:=Parts[ppType].EndPos;
             ASourceChangeCache.Replace(gtSpace,gtNone,InsertPos,InsertPos,
    
    competion_indexed.patch (2,088 bytes)

Relationships

has duplicate 0017673 closedMattias Gaertner Lazarus Code completion creates unneeded procedures when using index on properties 

Activities

2011-01-06 17:48

 

competion_indexed.patch (2,088 bytes)
Index: codecompletiontool.pas
===================================================================
--- codecompletiontool.pas	(revision 28873)
+++ codecompletiontool.pas	(working copy)
@@ -5353,10 +5353,10 @@
            AccessParam);
       end else begin
         // 'read' keyword does not exist -> insert behind index and type
-        if Parts[ppIndexWord].StartPos>0 then
+        if Parts[ppIndex].StartPos>0 then
+          InsertPos:=Parts[ppIndex].EndPos
+        else if Parts[ppIndexWord].StartPos>0 then
           InsertPos:=Parts[ppIndexWord].EndPos
-        else if Parts[ppIndex].StartPos>0 then
-          InsertPos:=Parts[ppIndex].EndPos
         else
           InsertPos:=Parts[ppType].EndPos;
         ASourceChangeCache.Replace(gtSpace,gtNone,InsertPos,InsertPos,
@@ -5378,7 +5378,7 @@
         CleanAccessFunc:=UpperCaseStr(AccessParam)+'('+CleanParamList+');';
       end else begin
         // index + param list
-        CleanAccessFunc:=UpperCaseStr(AccessParam)+'(:INTEGER;'
+        CleanAccessFunc:=UpperCaseStr(AccessParam)+'(INTEGER;'
                         +CleanParamList+');';
       end;
     end else begin
@@ -5387,7 +5387,7 @@
         CleanAccessFunc:=UpperCaseStr(AccessParam)+';';
       end else begin
         // index, no param list
-        CleanAccessFunc:=UpperCaseStr(AccessParam)+'(:INTEGER);';
+        CleanAccessFunc:=UpperCaseStr(AccessParam)+'(INTEGER);';
       end;
     end;
     if ProcExistsInCodeCompleteClass(CleanAccessFunc) then exit;
@@ -5484,10 +5484,10 @@
           InsertPos:=Parts[ppRead].EndPos
         else if Parts[ppReadWord].StartPos>0 then
           InsertPos:=Parts[ppReadWord].EndPos
+        else if Parts[ppIndex].StartPos>0 then
+          InsertPos:=Parts[ppIndex].EndPos
         else if Parts[ppIndexWord].StartPos>0 then
           InsertPos:=Parts[ppIndexWord].EndPos
-        else if Parts[ppIndex].StartPos>0 then
-          InsertPos:=Parts[ppIndex].EndPos
         else
           InsertPos:=Parts[ppType].EndPos;
         ASourceChangeCache.Replace(gtSpace,gtNone,InsertPos,InsertPos,
competion_indexed.patch (2,088 bytes)

Mattias Gaertner

2011-01-06 18:22

manager   ~0044955

Thanks. Applied.

Issue History

Date Modified Username Field Change
2011-01-06 17:48 Alexander S. Klenin New Issue
2011-01-06 17:48 Alexander S. Klenin File Added: competion_indexed.patch
2011-01-06 17:48 Alexander S. Klenin LazTarget => -
2011-01-06 18:22 Mattias Gaertner Note Added: 0044955
2011-01-06 18:22 Mattias Gaertner Assigned To => Mattias Gaertner
2011-01-06 18:22 Mattias Gaertner Status new => resolved
2011-01-06 18:22 Mattias Gaertner Resolution open => fixed
2011-01-06 19:22 Alexander S. Klenin Status resolved => closed
2011-01-06 19:22 Alexander S. Klenin Target Version => 0.9.30
2011-01-06 20:45 Alexander S. Klenin Relationship added has duplicate 0017673
2011-01-24 10:34 Vincent Snijders Fixed in Version => 0.9.29 (SVN)