mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-14 19:19:18 +02:00
IDE: help on unknown identifier: start codebrowser
git-svn-id: trunk@43891 -
This commit is contained in:
parent
289de72412
commit
551badbbf0
@ -54,7 +54,7 @@ uses
|
|||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
IDEFPDocFileSearch, PackageDefs, PackageSystem,
|
IDEFPDocFileSearch, PackageDefs, PackageSystem,
|
||||||
HelpOptions, MainIntf, LazConf, HelpFPCMessages, CodeHelp,
|
HelpOptions, MainIntf, LazConf, HelpFPCMessages, CodeHelp,
|
||||||
IDEContextHelpEdit, IDEWindowHelp;
|
IDEContextHelpEdit, IDEWindowHelp, CodeBrowser;
|
||||||
|
|
||||||
type
|
type
|
||||||
|
|
||||||
@ -1377,7 +1377,7 @@ end;
|
|||||||
function TIDEHelpManager.ShowHelpForSourcePosition(const Filename: string;
|
function TIDEHelpManager.ShowHelpForSourcePosition(const Filename: string;
|
||||||
const CodePos: TPoint; var ErrMsg: string): TShowHelpResult;
|
const CodePos: TPoint; var ErrMsg: string): TShowHelpResult;
|
||||||
|
|
||||||
function CollectKeyWords(CodeBuffer: TCodeBuffer): TShowHelpResult;
|
function CollectKeyWords(CodeBuffer: TCodeBuffer; out Identifier: string): TShowHelpResult;
|
||||||
var
|
var
|
||||||
p: Integer;
|
p: Integer;
|
||||||
IdentStart, IdentEnd: integer;
|
IdentStart, IdentEnd: integer;
|
||||||
@ -1385,11 +1385,13 @@ function TIDEHelpManager.ShowHelpForSourcePosition(const Filename: string;
|
|||||||
ErrorMsg: String;
|
ErrorMsg: String;
|
||||||
begin
|
begin
|
||||||
Result:=shrHelpNotFound;
|
Result:=shrHelpNotFound;
|
||||||
|
Identifier:='';
|
||||||
p:=0;
|
p:=0;
|
||||||
CodeBuffer.LineColToPosition(CodePos.Y,CodePos.X,p);
|
CodeBuffer.LineColToPosition(CodePos.Y,CodePos.X,p);
|
||||||
if p<1 then exit;
|
if p<1 then exit;
|
||||||
GetIdentStartEndAtPosition(CodeBuffer.Source,p,IdentStart,IdentEnd);
|
GetIdentStartEndAtPosition(CodeBuffer.Source,p,IdentStart,IdentEnd);
|
||||||
if IdentEnd<=IdentStart then exit;
|
if IdentEnd<=IdentStart then exit;
|
||||||
|
Identifier:=copy(CodeBuffer.Source,IdentStart,IdentEnd-IdentStart);
|
||||||
if (IdentStart > 1) and (CodeBuffer.Source[IdentStart - 1] in ['$','%']) then
|
if (IdentStart > 1) and (CodeBuffer.Source[IdentStart - 1] in ['$','%']) then
|
||||||
Dec(IdentStart);
|
Dec(IdentStart);
|
||||||
KeyWord:=copy(CodeBuffer.Source,IdentStart,IdentEnd-IdentStart);
|
KeyWord:=copy(CodeBuffer.Source,IdentStart,IdentEnd-IdentStart);
|
||||||
@ -1463,6 +1465,7 @@ function TIDEHelpManager.ShowHelpForSourcePosition(const Filename: string;
|
|||||||
var
|
var
|
||||||
CodeBuffer: TCodeBuffer;
|
CodeBuffer: TCodeBuffer;
|
||||||
Complete: boolean;
|
Complete: boolean;
|
||||||
|
Identifier: string;
|
||||||
begin
|
begin
|
||||||
debugln('TIDEHelpManager.ShowHelpForSourcePosition A Filename=',Filename,' ',dbgs(CodePos));
|
debugln('TIDEHelpManager.ShowHelpForSourcePosition A Filename=',Filename,' ',dbgs(CodePos));
|
||||||
Result:=shrHelpNotFound;
|
Result:=shrHelpNotFound;
|
||||||
@ -1477,9 +1480,15 @@ begin
|
|||||||
Result:=CollectDeclarations(CodeBuffer,Complete);
|
Result:=CollectDeclarations(CodeBuffer,Complete);
|
||||||
if Complete then exit;
|
if Complete then exit;
|
||||||
debugln(['TIDEHelpManager.ShowHelpForSourcePosition no declaration found, trying keywords ...']);
|
debugln(['TIDEHelpManager.ShowHelpForSourcePosition no declaration found, trying keywords ...']);
|
||||||
Result:=CollectKeyWords(CodeBuffer);
|
Result:=CollectKeyWords(CodeBuffer,Identifier);
|
||||||
if Result in [shrCancel,shrSuccess] then exit;
|
if Result in [shrCancel,shrSuccess] then exit;
|
||||||
debugln(['TIDEHelpManager.ShowHelpForSourcePosition END']);
|
if IsValidIdent(Identifier) then
|
||||||
|
begin
|
||||||
|
debugln(['TIDEHelpManager.ShowHelpForSourcePosition "',Identifier,'" is not a FPC keyword, search via code browser ...']);
|
||||||
|
ShowCodeBrowser(Identifier);
|
||||||
|
exit(shrSuccess);
|
||||||
|
end;
|
||||||
|
debugln(['TIDEHelpManager.ShowHelpForSourcePosition "',Identifier,'" is not a FPC keyword']);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TIDEHelpManager.ConvertCodePosToPascalHelpContext(
|
function TIDEHelpManager.ConvertCodePosToPascalHelpContext(
|
||||||
|
Loading…
Reference in New Issue
Block a user