From 119dc4be64d88c5ea6b148fb228fd6da767db94e Mon Sep 17 00:00:00 2001 From: mattias Date: Wed, 5 Feb 2014 10:15:15 +0000 Subject: [PATCH] IDE: help for unknown identifier: do not show error about FPC keyword, the following error is enough git-svn-id: trunk@43889 - --- ide/idehelpmanager.pas | 10 +++++++++- lcl/helpintfs.pas | 6 +++--- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/ide/idehelpmanager.pas b/ide/idehelpmanager.pas index 155d243d0d..8f807c95ca 100644 --- a/ide/idehelpmanager.pas +++ b/ide/idehelpmanager.pas @@ -1400,8 +1400,13 @@ function TIDEHelpManager.ShowHelpForSourcePosition(const Filename: string; Result:=ShowHelpForDirective('',IDEDirectiveHelpPrefix+Keyword,ErrorMsg) else Result:=ShowHelpForKeyword('',FPCKeyWordHelpPrefix+Keyword,ErrorMsg); - if Result=shrHelpNotFound then exit; + if Result=shrSuccess then + exit; + if Result in [shrNone,shrDatabaseNotFound,shrContextNotFound,shrHelpNotFound] then + exit(shrHelpNotFound); // not a FPC keyword + // viewer error HelpManager.ShowError(Result,ErrorMsg); + Result:=shrCancel; end; function CollectDeclarations(CodeBuffer: TCodeBuffer; @@ -1471,7 +1476,10 @@ begin Result:=CollectDeclarations(CodeBuffer,Complete); if Complete then exit; + debugln(['TIDEHelpManager.ShowHelpForSourcePosition no declaration found, trying keywords ...']); Result:=CollectKeyWords(CodeBuffer); + if Result in [shrCancel,shrSuccess] then exit; + debugln(['TIDEHelpManager.ShowHelpForSourcePosition END']); end; function TIDEHelpManager.ConvertCodePosToPascalHelpContext( diff --git a/lcl/helpintfs.pas b/lcl/helpintfs.pas index 081ec38ea2..cde846ed90 100644 --- a/lcl/helpintfs.pas +++ b/lcl/helpintfs.pas @@ -43,8 +43,8 @@ type shrSuccess, shrCancel, shrDatabaseNotFound, - shrContextNotFound, - shrViewerNotFound, + shrContextNotFound, // database found, but the element was not found + shrViewerNotFound, // no viewer registered for this format shrHelpNotFound, shrViewerError, shrSelectorError @@ -250,7 +250,7 @@ function ShowHelpForContext(HelpDatabaseID: THelpDatabaseID; function ShowHelpForContext(HelpContext: THelpContext; var ErrMsg: string ): TShowHelpResult; overload; -// help by keyword (an arbitrary keyword, not a fpc keyword) +// help by keyword (an arbitrary keyword, not only fpc keyword) function ShowHelpOrErrorForKeyword(HelpDatabaseID: THelpDatabaseID; const HelpKeyword: string): TShowHelpResult; function ShowHelpForKeyword(HelpDatabaseID: THelpDatabaseID;