diff --git a/components/codetools/stdcodetools.pas b/components/codetools/stdcodetools.pas index bd8dd19991..43e5cb5012 100644 --- a/components/codetools/stdcodetools.pas +++ b/components/codetools/stdcodetools.pas @@ -3788,12 +3788,17 @@ begin // find node ANode:=FindDeepestNodeAtPos(CleanCursorPos,true); if (ANode=nil) then exit; + if (ANode.Desc=ctnProcedureHead) + and (ANode.Parent<>nil) and (ANode.Parent.Desc=ctnProcedure) then + ANode:=ANode.Parent; + NextNode:=ANode.Next; if NextNode<>nil then EndPos:=NextNode.StartPos else EndPos:=ANode.EndPos; + //DebugLn(['TStandardCodeTool.GetPasDocComments ',copy(Src,ANode.StartPos,ANode.EndPos-ANode.StartPos)]); // read comments (start in front of node) p:=FindLineEndOrCodeInFrontOfPosition(ANode.StartPos,true); while pnil) and (Node.Parent.Desc=ctnProcedure) then + Node:=Node.Parent; if not (Node.Desc in (AllIdentifierDefinitions+[ctnProperty,ctnProcedure,ctnEnumIdentifier])) then begin @@ -784,15 +787,16 @@ begin Item:=Chain[i]; ItemAdded:=false; DebugLn(['TLazDocManager.GetHint ',i,' Element=',Item.ElementName]); - if Item.ElementNode=nil then continue; - NodeValues:=Item.FPDocFile.GetValuesFromNode(Item.ElementNode); - for f:=Low(TFPDocItem) to High(TFPDocItem) do - DebugLn(['TLazDocManager.GetHint ',FPDocItemNames[f],' ',NodeValues[f]]); - if NodeValues[fpdiShort]<>'' then begin - Hint:=Hint+#13#13 - +Item.ElementName+#13 - +NodeValues[fpdiShort]; - ItemAdded:=true; + if Item.ElementNode<>nil then begin + NodeValues:=Item.FPDocFile.GetValuesFromNode(Item.ElementNode); + for f:=Low(TFPDocItem) to High(TFPDocItem) do + DebugLn(['TLazDocManager.GetHint ',FPDocItemNames[f],' ',NodeValues[f]]); + if NodeValues[fpdiShort]<>'' then begin + Hint:=Hint+#13#13 + +Item.ElementName+#13 + +NodeValues[fpdiShort]; + ItemAdded:=true; + end; end; // Add comments