mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-11-03 02:10:03 +01:00
codetools: identifier completion: no semicolon outside of statements
git-svn-id: trunk@16669 -
This commit is contained in:
parent
a58a097488
commit
d7a960e8ba
@ -1537,26 +1537,28 @@ begin
|
|||||||
MoveCursorToCleanPos(IdentEndPos);
|
MoveCursorToCleanPos(IdentEndPos);
|
||||||
ReadNextAtom;
|
ReadNextAtom;
|
||||||
CurrentIdentifierList.StartAtomBehind:=CurPos;
|
CurrentIdentifierList.StartAtomBehind:=CurPos;
|
||||||
|
// check if a semicolon is needed at the end
|
||||||
|
if (CurrentIdentifierList.StartBracketLvl>0)
|
||||||
|
or (CurPos.Flag in [cafSemicolon, cafEqual, cafColon, cafComma,
|
||||||
|
cafPoint, cafRoundBracketOpen, cafRoundBracketClose,
|
||||||
|
cafEdgedBracketOpen, cafEdgedBracketClose])
|
||||||
|
or ((CurPos.Flag=cafWord)
|
||||||
|
and (UpAtomIs('ELSE')
|
||||||
|
or UpAtomIs('THEN')
|
||||||
|
or UpAtomIs('DO')
|
||||||
|
or UpAtomIs('TO')
|
||||||
|
or UpAtomIs('OF')))
|
||||||
|
then begin
|
||||||
|
// do not add semicolon
|
||||||
|
CurrentIdentifierList.ContextFlags:=
|
||||||
|
CurrentIdentifierList.ContextFlags+[ilcfNoEndSemicolon];
|
||||||
|
end;
|
||||||
// check if in statement
|
// check if in statement
|
||||||
if (ilcfStartInStatement in CurrentIdentifierList.ContextFlags) then
|
if (ilcfStartInStatement in CurrentIdentifierList.ContextFlags) then
|
||||||
begin
|
begin
|
||||||
// check if a semicolon is needed at the end
|
// check if a semicolon is needed at the end
|
||||||
if (CurrentIdentifierList.StartBracketLvl>0)
|
if (not (ilcfNoEndSemicolon in CurrentIdentifierList.ContextFlags))
|
||||||
or (CurPos.Flag in [cafSemicolon, cafEqual, cafColon, cafComma,
|
and (not (ilcfStartIsLValue in CurrentIdentifierList.ContextFlags))
|
||||||
cafPoint, cafRoundBracketOpen, cafRoundBracketClose,
|
|
||||||
cafEdgedBracketOpen, cafEdgedBracketClose])
|
|
||||||
or ((CurPos.Flag=cafWord)
|
|
||||||
and (UpAtomIs('ELSE')
|
|
||||||
or UpAtomIs('THEN')
|
|
||||||
or UpAtomIs('DO')
|
|
||||||
or UpAtomIs('TO')
|
|
||||||
or UpAtomIs('OF')))
|
|
||||||
then begin
|
|
||||||
// do not add semicolon
|
|
||||||
CurrentIdentifierList.ContextFlags:=
|
|
||||||
CurrentIdentifierList.ContextFlags+[ilcfNoEndSemicolon];
|
|
||||||
end
|
|
||||||
else if (not (ilcfStartIsLValue in CurrentIdentifierList.ContextFlags))
|
|
||||||
then begin
|
then begin
|
||||||
// check if a semicolon is needed at the end
|
// check if a semicolon is needed at the end
|
||||||
if (CurPos.Flag in [cafEnd,cafBegin])
|
if (CurPos.Flag in [cafEnd,cafBegin])
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user