mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-12-10 00:17:18 +01:00
identifier completion: improved heuristic to recognize LValue
git-svn-id: trunk@9294 -
This commit is contained in:
parent
c8920abb80
commit
47948ab39e
@ -122,7 +122,8 @@ type
|
||||
TIdentifierListContextFlag = (
|
||||
ilcfStartInStatement, // context starts in statements. e.g. between begin..end
|
||||
ilcfStartIsLValue, // position is start of one statement. e.g. 'A:='
|
||||
ilcfNeedsEndSemicolon // after context a semicolon is needed. e.g. 'A end'
|
||||
ilcfNeedsEndSemicolon,// after context a semicolon is needed. e.g. 'A end'
|
||||
ilcfIsExpression // is expression part of statement. e.g. 'if expr'
|
||||
);
|
||||
TIdentifierListContextFlags = set of TIdentifierListContextFlag;
|
||||
|
||||
@ -1242,6 +1243,11 @@ begin
|
||||
CurrentIdentifierList.ContextFlags:=
|
||||
CurrentIdentifierList.ContextFlags+[ilcfStartIsLValue];
|
||||
end;
|
||||
if UpAtomIs('IF') or UpAtomIs('FOR') or UpAtomIs('DO')
|
||||
or UpAtomIs('CASE') or UpAtomIs('OF') then begin
|
||||
CurrentIdentifierList.ContextFlags:=
|
||||
CurrentIdentifierList.ContextFlags+[ilcfIsExpression];
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
// context behind
|
||||
|
||||
@ -383,9 +383,8 @@ begin
|
||||
// add semicolon for statement ends
|
||||
if (ilcfNeedsEndSemicolon in IdentList.ContextFlags) then begin
|
||||
Result:=Result+';';
|
||||
DebugLn('GetIdentCompletionValue ilcfStartIsLValue in IdentList.ContextFlags=',dbgs(ilcfStartIsLValue in IdentList.ContextFlags));
|
||||
if (not CursorAtEnd) or IdentItem.HasChilds
|
||||
or (ilcfStartIsLValue in IdentList.ContextFlags) then
|
||||
or ([ilcfStartIsLValue,ilcfIsExpression]*IdentList.ContextFlags<>[]) then
|
||||
inc(CursorToLeft);
|
||||
end;
|
||||
end;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user