codetools: identifier completion: add := only if at end o line

git-svn-id: trunk@21021 -
This commit is contained in:
mattias 2009-07-31 13:47:46 +00:00
parent 8bff99b9f7
commit cde0653dfb
2 changed files with 15 additions and 2 deletions

View File

@ -170,7 +170,8 @@ type
ilcfNoEndSemicolon, // no semicolon after. E.g. 'A| else'
ilcfNeedsEndComma, // after context a comma is needed. e.g. 'sysutil| classes'
ilcfIsExpression, // is expression part of statement. e.g. 'if expr'
ilcfCanProcDeclaration // context allows to declare a procedure/method
ilcfCanProcDeclaration,// context allows to declare a procedure/method
ilcfEndOfLine // atom at end of line
);
TIdentifierListContextFlags = set of TIdentifierListContextFlag;
@ -1862,6 +1863,12 @@ begin
if IdentEndPos<SrcLen then begin
MoveCursorToCleanPos(IdentEndPos);
ReadNextAtom;
// check end of line
if not PositionsInSameLine(Src,IdentEndPos,CurPos.StartPos) then
CurrentIdentifierList.ContextFlags:=
CurrentIdentifierList.ContextFlags+[ilcfEndOfLine];
CurrentIdentifierList.StartAtomBehind:=CurPos;
// check if a semicolon is needed or forbidden at the end
if (CurrentIdentifierList.StartBracketLvl>0)
@ -1901,6 +1908,10 @@ begin
end;
end;
end;
end else begin
// end of source
CurrentIdentifierList.ContextFlags:=
CurrentIdentifierList.ContextFlags+[ilcfEndOfLine];
end;
// check for procedure/method declaration context

View File

@ -575,9 +575,11 @@ begin
// add assignment operator :=
if (CursorToLeft=0)
and (AddChar='')
and (ilcfStartOfStatement in IdentList.ContextFlags)
and (ilcfStartOfStatement in IdentList.ContextFlags)
and (ilcfEndOfLine in IdentList.ContextFlags)
and (not IdentItem.HasChilds)
and (not IdentList.StartUpAtomBehindIs(':='))
and (not IdentList.StartUpAtomBehindIs('('))
and (IdentItem.CanBeAssigned)
and CodeToolsOpts.IdentComplAddAssignOperator then begin
if (atIdentifier in CodeToolsOpts.DoInsertSpaceAfter)