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

View File

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

View File

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