mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-11-08 13:09:50 +01:00
codetools: class completion: implemented property types with units prefixes, bug #11827
git-svn-id: trunk@19590 -
This commit is contained in:
parent
09148347e9
commit
c5b4688ec5
@ -4348,6 +4348,7 @@ 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
|
||||||
@ -4446,16 +4447,30 @@ var AccessParam, AccessParamPrefix, CleanAccessFunc, AccessFunc,
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
procedure ReadPropertyType;
|
procedure ReadPropertyType;
|
||||||
|
|
||||||
|
procedure CheckIdentifier;
|
||||||
|
begin
|
||||||
|
if (CurPos.StartPos>PropNode.EndPos)
|
||||||
|
or UpAtomIs('END') or AtomIsChar(';') or (not AtomIsIdentifier(false))
|
||||||
|
or AtomIsKeyWord then begin
|
||||||
|
// no type name found -> ignore this property
|
||||||
|
RaiseExceptionFmt(ctsPropertTypeExpectedButAtomFound,[GetAtom]);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
ReadNextAtom; // read type
|
ReadNextAtom; // read type
|
||||||
if (CurPos.StartPos>PropNode.EndPos)
|
CheckIdentifier;
|
||||||
or UpAtomIs('END') or AtomIsChar(';') or (not AtomIsIdentifier(false))
|
|
||||||
or AtomIsKeyWord then begin
|
|
||||||
// no type name found -> ignore this property
|
|
||||||
RaiseExceptionFmt(ctsPropertTypeExpectedButAtomFound,[GetAtom]);
|
|
||||||
end;
|
|
||||||
Parts[ppType]:=CurPos;
|
Parts[ppType]:=CurPos;
|
||||||
ReadNextAtom;
|
ReadNextAtom;
|
||||||
|
if CurPos.Flag=cafPoint then begin
|
||||||
|
// unit.identifier
|
||||||
|
Parts[ppUnitType]:=Parts[ppType];
|
||||||
|
ReadNextAtom;
|
||||||
|
CheckIdentifier;
|
||||||
|
Parts[ppType]:=CurPos;
|
||||||
|
ReadNextAtom;
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure ReadIndexSpecifier;
|
procedure ReadIndexSpecifier;
|
||||||
@ -4880,7 +4895,10 @@ begin
|
|||||||
ReadWriteSpecifier;
|
ReadWriteSpecifier;
|
||||||
ReadOptionalSpecifiers;
|
ReadOptionalSpecifiers;
|
||||||
PropType:=copy(Src,Parts[ppType].StartPos,
|
PropType:=copy(Src,Parts[ppType].StartPos,
|
||||||
Parts[ppType].EndPos-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:=ASourceChangeCache.BeautifyCodeOptions;
|
BeautifyCodeOpts:=ASourceChangeCache.BeautifyCodeOptions;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user