automatic identifier completion does not longer jump to errors

git-svn-id: trunk@7514 -
This commit is contained in:
mattias 2005-08-17 08:14:36 +00:00
parent abd1617411
commit 0b9be2f264
2 changed files with 35 additions and 32 deletions

View File

@ -314,7 +314,7 @@ type
procedure OnSrcNotebookFileClose(Sender: TObject);
procedure OnSrcNotebookFindDeclaration(Sender: TObject);
procedure OnSrcNotebookInitIdentCompletion(Sender: TObject;
var Handled, Abort: boolean);
JumpToError: boolean; out Handled, Abort: boolean);
procedure OnSrcNotebookJumpToHistoryPoint(var NewCaretXY: TPoint;
var NewTopLine, NewPageIndex: integer; JumpAction: TJumpHistoryAction);
procedure OnSrcNotebookMovingPage(Sender: TObject;
@ -730,7 +730,7 @@ type
procedure DoFindDeclarationAtCursor;
procedure DoFindDeclarationAtCaret(const LogCaretXY: TPoint);
function DoFindRenameIdentifier(Rename: boolean): TModalResult;
function DoInitIdentCompletion: boolean;
function DoInitIdentCompletion(JumpToError: boolean): boolean;
procedure DoCompleteCodeAtCursor;
procedure DoExtractProcFromSelection;
function DoCheckSyntax: TModalResult;
@ -2152,10 +2152,10 @@ begin
end;
procedure TMainIDE.OnSrcNotebookInitIdentCompletion(Sender: TObject;
var Handled, Abort: boolean);
JumpToError: boolean; out Handled, Abort: boolean);
begin
Handled:=true;
Abort:=not DoInitIdentCompletion;
Abort:=not DoInitIdentCompletion(JumpToError);
end;
Procedure TMainIDE.OnSrcNotebookSaveAll(Sender: TObject);
@ -10306,9 +10306,9 @@ begin
end;
{-------------------------------------------------------------------------------
function TMainIDE.DoInitIdentCompletion: boolean;
function TMainIDE.DoInitIdentCompletion(JumpToError: boolean): boolean;
-------------------------------------------------------------------------------}
function TMainIDE.DoInitIdentCompletion: boolean;
function TMainIDE.DoInitIdentCompletion(JumpToError: boolean): boolean;
var
ActiveSrcEdit: TSourceEditor;
ActiveUnitInfo: TUnitInfo;
@ -10324,6 +10324,7 @@ begin
Result:=CodeToolBoss.GatherIdentifiers(ActiveUnitInfo.Source,
LogCaretXY.X,LogCaretXY.Y);
if not Result then begin
if JumpToError then
DoJumpToCodeToolBossError;
exit;
end;

View File

@ -188,7 +188,7 @@ type
procedure SetExecutionLine(NewLine: integer);
procedure OnCodeBufferChanged(Sender: TSourceLog;
SrcLogEntry: TSourceLogEntry);
procedure StartIdentCompletion;
procedure StartIdentCompletion(JumpToError: boolean);
procedure LinesInserted(sender: TObject; FirstLine,Count: Integer);
procedure LinesDeleted(sender: TObject; FirstLine,Count: Integer);
@ -320,8 +320,8 @@ type
OldPageIndex, NewPageIndex: integer) of object;
TOnShowHintForSource = procedure(SrcEdit: TSourceEditor; ClientPos: TPoint;
CaretPos: TPoint) of object;
TOnInitIdentCompletion = procedure(Sender: TObject;
var Handled, Abort: boolean) of object;
TOnInitIdentCompletion = procedure(Sender: TObject; JumpToError: boolean;
out Handled, Abort: boolean) of object;
TSrcEditPopupMenuEvent = procedure(AddMenuItemProc: TAddMenuItemProc
) of object;
@ -397,6 +397,7 @@ type
FCodeTemplateModul: TSynEditAutoComplete;
fCustomPopupMenuItems: TList;
fContextPopupMenuItems: TList;
fIdentCompletionJumpToError: boolean;
FIncrementalSearchPos: TPoint; // last set position
fIncrementalSearchStartPos: TPoint; // position where to start searching
fIncrementalSearchCancelPos: TPoint;// position where to jump on cancel
@ -1180,7 +1181,7 @@ Begin
FindHelpForSourceAtCursor;
ecIdentCompletion :
StartIdentCompletion;
StartIdentCompletion(true);
ecWordCompletion :
if not TCustomSynEdit(Sender).ReadOnly then begin
@ -1911,15 +1912,17 @@ writeln('[TSourceEditor.OnCodeBufferChanged] A ',FIgnoreCodeBufferLock,' ',SrcLo
end;
end;
procedure TSourceEditor.StartIdentCompletion;
procedure TSourceEditor.StartIdentCompletion(JumpToError: boolean);
var
I: Integer;
P: TPoint;
TextS, TextS2: String;
LogCaret: TPoint;
begin
debugln('TSourceEditor.StartIdentCompletion');
if not FEditor.ReadOnly then begin
//debugln('TSourceEditor.StartIdentCompletion');
if FEditor.ReadOnly then exit;
SourceNoteBook.fIdentCompletionJumpToError:=JumpToError;
CurrentCompletionType:=ctIdentCompletion;
TextS := FEditor.LineText;
LogCaret:=FEditor.LogicalCaretXY;
@ -1937,7 +1940,6 @@ begin
aCompletion.Editor:=FEditor;
aCompletion.Execute(TextS2,P.X,P.Y);
end;
end;
procedure TSourceEditor.IncreaseIgnoreCodeBufferLock;
begin
@ -2525,7 +2527,7 @@ begin
IdentCompletionTimer.Enabled:=false;
IdentCompletionTimer.AutoEnabled:=false;
TempEditor:=GetActiveSE;
if TempEditor<>nil then TempEditor.StartIdentCompletion;
if TempEditor<>nil then TempEditor.StartIdentCompletion(false);
end;
procedure TSourceNotebook.OnCodeTemplateTokenNotFound(Sender: TObject;
@ -2683,7 +2685,7 @@ var
begin
Prefix := CurCompletionControl.CurrentString;
if Assigned(OnInitIdentCompletion) then begin
OnInitIdentCompletion(Self,Handled,Abort);
OnInitIdentCompletion(Self,fIdentCompletionJumpToError,Handled,Abort);
if Handled then begin
if Abort then exit;
// add one entry per item