From 6f6df5602b30425b549eff257fb5c8e90a40cabe Mon Sep 17 00:00:00 2001 From: Juha Date: Mon, 3 Mar 2025 22:37:39 +0200 Subject: [PATCH] =?UTF-8?q?Codetools:=20Prevent=20error=20in=20identifier?= =?UTF-8?q?=20completion=20while=20defining=20a=20function.=20Issue=20#329?= =?UTF-8?q?72,=20patch=20by=20W=C5=82odzimierz=20Bie=C5=84.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/codetools/identcompletiontool.pas | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/components/codetools/identcompletiontool.pas b/components/codetools/identcompletiontool.pas index 0166621d0a..8b9766e6d7 100644 --- a/components/codetools/identcompletiontool.pas +++ b/components/codetools/identcompletiontool.pas @@ -965,14 +965,6 @@ procedure TIdentifierList.Add(NewItem: TIdentifierListItem); var AnAVLNode: TAVLTreeNode; begin - if (ilcfDontAllowProcedures in ContextFlags) and (NewItem.GetDesc = ctnProcedure) and - not (NewItem.IsFunction or NewItem.IsConstructor) - then - begin - NewItem.Free; - Exit; - end; - AnAVLNode:=FIdentView.FindKey(NewItem,@CompareIdentListItemsForIdents); if AnAVLNode=nil then begin if History<>nil then @@ -1368,12 +1360,9 @@ var Node: TCodeTreeNode; ProtectedForeignClass: Boolean; Lvl: LongInt; - NamePos: TAtomPosition; HasLowerVisibility: Boolean; IsDottedIdent: Boolean; PlaceForDotted: string; - PlaceForNamespace: string; - i: integer; begin // proceed searching ... Result:=ifrProceedSearch; @@ -1512,9 +1501,16 @@ begin exit; // there is a previous declaration without 'overload' end; end; + end else begin + if (CurrentIdentifierList.StartContext.Node.Parent<>nil) and + (CurrentIdentifierList.StartContext.Node.Parent.Parent=FoundContext.Node) + then begin // skip adding itself at function/procedure parameters definition + debugln(['TIdentCompletionTool.CollectAllIdentifiers ','skipped "',GetIdentifier(Ident),'"']); + exit; + end; end; end; - + ctnProperty: begin Ident:=FoundContext.Tool.GetPropertyNameIdentifier(FoundContext.Node);