mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-05-06 10:53:05 +02:00
codetools: raise assignment exception instead of the first one. Issue #29448
git-svn-id: trunk@51391 -
This commit is contained in:
parent
d6f267a40d
commit
c6d56cf204
@ -9337,8 +9337,7 @@ function TCodeCompletionCodeTool.CompleteCode(CursorPos: TCodeXYPosition;
|
||||
RaiseExceptionInstance(TempE);
|
||||
end;
|
||||
|
||||
function TryAssignment(CleanCursorPos: Integer; CursorNode: TCodeTreeNode;
|
||||
var LastCodeToolsError: ECodeToolError; LastCodeToolsErrorCleanPos: Integer): Boolean;
|
||||
function TryAssignment(CleanCursorPos: Integer; CursorNode: TCodeTreeNode): Boolean;
|
||||
begin
|
||||
// Search only within the current instruction - stop on semicolon or else
|
||||
// (else isn't prepended by a semicolon in contrast to other keywords).
|
||||
@ -9353,15 +9352,8 @@ function TCodeCompletionCodeTool.CompleteCode(CursorPos: TCodeXYPosition;
|
||||
begin
|
||||
// OK FOUND!
|
||||
ReadPriorAtom;
|
||||
try
|
||||
if TryComplete(CursorNode, CurPos.StartPos) then
|
||||
exit(true);
|
||||
except
|
||||
if LastCodeToolsError<>nil then
|
||||
ClearAndRaise(LastCodeToolsError, LastCodeToolsErrorCleanPos) // in case of error, raise the last one
|
||||
else
|
||||
raise;
|
||||
end;
|
||||
break;
|
||||
end;
|
||||
cafWord:
|
||||
@ -9435,7 +9427,7 @@ begin
|
||||
end;
|
||||
|
||||
// find first assignment before current.
|
||||
if TryAssignment(CleanCursorPos, CursorNode, LastCodeToolsError, LastCodeToolsErrorCleanPos) then
|
||||
if TryAssignment(CleanCursorPos, CursorNode) then
|
||||
Exit(true);
|
||||
|
||||
if LastCodeToolsError<>nil then // no assignment found, reraise
|
||||
|
Loading…
Reference in New Issue
Block a user