IDE+codetools: added heuristic to add := on identifier completion

git-svn-id: trunk@12348 -
This commit is contained in:
mattias 2007-10-06 14:54:32 +00:00
parent 7f32d1a1d3
commit 23cb06a031
2 changed files with 12 additions and 4 deletions

View File

@ -1393,14 +1393,13 @@ begin
if (ilcfStartInStatement in CurrentIdentifierList.ContextFlags) then
begin
if (CurPos.Flag in [cafSemicolon,cafBegin,cafEnd])
or WordIsBlockKeyWord.DoItUpperCase(UpperSrc,
CurPos.StartPos,CurPos.EndPos-CurPos.StartPos)
or UpAtomIs('TRY') or UpAtomIs('FOR') or UpAtomIs('DO')
then begin
CurrentIdentifierList.ContextFlags:=
CurrentIdentifierList.ContextFlags+[ilcfStartIsLValue];
end;
if UpAtomIs('IF') or UpAtomIs('FOR') or UpAtomIs('DO')
or UpAtomIs('CASE') or UpAtomIs('OF') then begin
or UpAtomIs('CASE') or UpAtomIs('OF') or UpAtomIs('WHILE') then begin
CurrentIdentifierList.ContextFlags:=
CurrentIdentifierList.ContextFlags+[ilcfIsExpression];
end;

View File

@ -36,7 +36,7 @@ interface
uses
Classes, SysUtils, LCLProc, LCLType, GraphType, Graphics, Controls,
SynEdit, SynRegExpr, SynCompletion,
BasicCodeTools, CodeTree, CodeAtom, CodeCache, CodeToolManager,
BasicCodeTools, CodeTree, CodeAtom, CodeCache, SourceChanger, CodeToolManager,
PascalParserTool, KeywordFuncLists, FileProcs, IdentCompletionTool,
LazIDEIntf, TextTools, IDETextConverter,
DialogProcs, MainIntf, EditorOptions, CodeToolsOptions;
@ -507,6 +507,15 @@ begin
CursorAtEnd:=false;
end;}
if (ilcfStartIsLValue in IdentList.ContextFlags) then begin
if (atIdentifier in CodeToolsOpts.DoInsertSpaceAfter)
or (atSymbol in CodeToolsOpts.DoInsertSpaceInFront) then
Result:=Result+' ';
Result:=Result+':=';
if (atSymbol in CodeToolsOpts.DoInsertSpaceAfter) then
Result:=Result+' ';
end;
if AddChar<>'' then
Result:=Result+AddChar;