mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-14 10:59:11 +02:00
IDE: Don't show inline comments in code tooltip if FPDoc content is available. Issue #14384, patch by Don Siders.
This commit is contained in:
parent
8836534b9c
commit
eb6ba60940
@ -40,7 +40,7 @@ interface
|
|||||||
|
|
||||||
uses
|
uses
|
||||||
// RTL + FCL
|
// RTL + FCL
|
||||||
Classes, SysUtils, AVL_Tree,
|
Classes, SysUtils, StrUtils, AVL_Tree,
|
||||||
// LCL
|
// LCL
|
||||||
Forms, Controls, Dialogs,
|
Forms, Controls, Dialogs,
|
||||||
// CodeTools
|
// CodeTools
|
||||||
@ -2485,6 +2485,15 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function GetMinWidthRule: String;
|
||||||
|
var
|
||||||
|
SpcWidth, SpcCnt: Integer;
|
||||||
|
begin
|
||||||
|
SpcWidth := Screen.PixelsPerInch div 6 div 2;
|
||||||
|
SpcCnt := (3 * (Screen.WorkAreaWidth div 8)) div SpcWidth;
|
||||||
|
Result := DupeString(' ', SpcCnt);
|
||||||
|
end;
|
||||||
|
|
||||||
function TCodeHelpManager.GetHTMLHintForExpr(CTExprType: TExpressionType;
|
function TCodeHelpManager.GetHTMLHintForExpr(CTExprType: TExpressionType;
|
||||||
XYPos: TCodeXYPosition; Options: TCodeHelpHintOptions; out BaseURL,
|
XYPos: TCodeXYPosition; Options: TCodeHelpHintOptions; out BaseURL,
|
||||||
HTMLHint: string; out CacheWasUsed: boolean): TCodeHelpParseResult;
|
HTMLHint: string; out CacheWasUsed: boolean): TCodeHelpParseResult;
|
||||||
@ -2507,6 +2516,7 @@ var
|
|||||||
Cmd: TKeyCommandRelation;
|
Cmd: TKeyCommandRelation;
|
||||||
CTTool: TFindDeclarationTool;
|
CTTool: TFindDeclarationTool;
|
||||||
CTNode: TCodeTreeNode;
|
CTNode: TCodeTreeNode;
|
||||||
|
HasXML: Boolean;
|
||||||
begin
|
begin
|
||||||
Result:=chprFailed;
|
Result:=chprFailed;
|
||||||
BaseURL:='lazdoc://';
|
BaseURL:='lazdoc://';
|
||||||
@ -2573,6 +2583,7 @@ begin
|
|||||||
Short:=AppendLineEnding(GetFPDocNodeAsHTML(FPDocFile,ElementNode.FindNode(FPDocItemNames[fpdiShort])));
|
Short:=AppendLineEnding(GetFPDocNodeAsHTML(FPDocFile,ElementNode.FindNode(FPDocItemNames[fpdiShort])));
|
||||||
Descr:=AppendLineEnding(GetFPDocNodeAsHTML(FPDocFile,ElementNode.FindNode(FPDocItemNames[fpdiDescription])));
|
Descr:=AppendLineEnding(GetFPDocNodeAsHTML(FPDocFile,ElementNode.FindNode(FPDocItemNames[fpdiDescription])));
|
||||||
s:=Short+Descr;
|
s:=Short+Descr;
|
||||||
|
HasXML := (Trim(s) <> '');
|
||||||
if chhoDeclarationHeader in Options then
|
if chhoDeclarationHeader in Options then
|
||||||
begin
|
begin
|
||||||
// Add Description header only when requested. Save space otherwise.
|
// Add Description header only when requested. Save space otherwise.
|
||||||
@ -2591,7 +2602,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
if chhoComments in Options then
|
if (chhoComments in Options) and (not HasXML) then
|
||||||
begin
|
begin
|
||||||
// add pasdoc
|
// add pasdoc
|
||||||
HTMLHint:=HTMLHint+GetPasDocCommentsAsHTML(CTTool,CTNode);
|
HTMLHint:=HTMLHint+GetPasDocCommentsAsHTML(CTTool,CTNode);
|
||||||
@ -2658,7 +2669,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
HTMLHint:='<html><head><link rel="stylesheet" href="lazdoc://lazarus/lazdoc.css" type="text/css">'+LineEnding
|
HTMLHint:='<html><head><link rel="stylesheet" href="lazdoc://lazarus/lazdoc.css" type="text/css">'+LineEnding
|
||||||
+'<meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head>'+LineEnding
|
+'<meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head>'+LineEnding
|
||||||
+'<body>'+LineEnding+HTMLHint+'</body>'+LineEnding;
|
+'<body>'+HTMLHint+IfThen(HasXML,GetMinWidthRule,'') +'</body></html>';
|
||||||
Result:=chprSuccess;
|
Result:=chprSuccess;
|
||||||
end else
|
end else
|
||||||
Result:=chprFailed;
|
Result:=chprFailed;
|
||||||
|
Loading…
Reference in New Issue
Block a user