codetools: complete property: set defaults, complex type

git-svn-id: trunk@56526 -
This commit is contained in:
mattias 2017-11-28 14:39:38 +00:00
parent 4e2b9026d4
commit ccea2a4b40
3 changed files with 20 additions and 18 deletions

View File

@ -6982,7 +6982,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
@ -7096,7 +7095,7 @@ var
CleanParamList:='';
end;
procedure ReadPropertyType;
function ReadPropertyType: string;
procedure CheckIdentifier;
begin
@ -7108,18 +7107,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;
@ -7643,7 +7642,7 @@ begin
exit;
end;
ReadPropertyType;
PropType:=ReadPropertyType;
// parse specifiers
if CodeCompleteClassNode.Desc <> ctnDispinterface then begin
ReadIndexSpecifier;
@ -7655,12 +7654,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

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

View File

@ -4060,7 +4060,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;