codetools: complete property: set defaults, complex type

git-svn-id: branches/fixes_1_8@56527 -
This commit is contained in:
mattias 2017-11-28 14:40:00 +00:00
parent 444e643150
commit e0e03d0f94
3 changed files with 20 additions and 18 deletions

View File

@ -6958,7 +6958,6 @@ function TCodeCompletionCodeTool.CompleteProperty(
type
TPropPart = (ppName, // property name
ppParamList, // param list
ppUnitType, // optional: unit in front of identifier
ppType, // type identifier
ppIndexWord, // 'index'
ppIndex, // index constant
@ -7072,7 +7071,7 @@ var
CleanParamList:='';
end;
procedure ReadPropertyType;
function ReadPropertyType: string;
procedure CheckIdentifier;
begin
@ -7084,18 +7083,18 @@ var
end;
end;
var
p: Integer;
begin
ReadNextAtom; // read type
CheckIdentifier;
Parts[ppType]:=CurPos;
ReadNextAtom;
if CurPos.Flag=cafPoint then begin
// unit.identifier
Parts[ppUnitType]:=Parts[ppType];
ReadNextAtom;
CheckIdentifier;
Parts[ppType]:=CurPos;
ReadNextAtom;
Result:=GetAtom;
ReadTypeReference(false);
p:=LastAtoms.GetPriorAtom.EndPos;
if p>Parts[ppType].EndPos then begin
Parts[ppType].EndPos:=p;
Result:=ExtractCode(Parts[ppType].StartPos,Parts[ppType].EndPos,[]);
end;
end;
@ -7619,7 +7618,7 @@ begin
exit;
end;
ReadPropertyType;
PropType:=ReadPropertyType;
// parse specifiers
if CodeCompleteClassNode.Desc <> ctnDispinterface then begin
ReadIndexSpecifier;
@ -7631,12 +7630,7 @@ begin
ReadNextAtom;
ReadDispidSpecifier;
end;
PropType:=copy(Src,Parts[ppType].StartPos,
Parts[ppType].EndPos-Parts[ppType].StartPos);
if Parts[ppUnitType].StartPos>0 then
PropType:=copy(Src,Parts[ppUnitType].StartPos,
Parts[ppUnitType].EndPos-Parts[ppUnitType].StartPos)+'.'+PropType;
// complete property
BeautifyCodeOpts:=FSourceChangeCache.BeautifyCodeOptions;
if CodeCompleteClassNode.Desc <> ctnDispinterface then begin

View File

@ -1020,7 +1020,13 @@ begin
FAddInheritedCodeToOverrideMethod:=true;
FAdjustTopLineDueToComment:=true;
FCatchExceptions:=true;
FCompleteProperties:=true;
FSetPropertyVariablename:='AValue';
FSetPropertyVariableIsPrefix := false;
FSetPropertyVariableUseConst := false;
FAddInheritedCodeToOverrideMethod := true;
FCursorBeyondEOL:=true;
FIndentSize:=2;
FJumpCentered:=true;

View File

@ -4015,7 +4015,9 @@ begin
ReadNextAtom;
if (TypeNode.Desc=ctnGenericType) and (not AtomIsChar('<')) then
SaveRaiseCharExpectedButAtomFound(20170421195732,'<');
if AtomIsChar('<') then begin
if AtomIsChar('<')
and (IsGeneric or (Scanner.CompilerMode in [cmDELPHI,cmDELPHIUNICODE])) then
begin
TypeNode.Desc:=ctnGenericType;
// name
CreateChildNode;