mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-16 23:49:28 +02:00
codetools: added ctnConstant and added showing constant in smart hints
git-svn-id: trunk@8923 -
This commit is contained in:
parent
520044e849
commit
b2be114279
@ -114,6 +114,7 @@ const
|
||||
ctnSpecializeType = 79;
|
||||
ctnSpecializeParams= 80;
|
||||
ctnGenericType = 81;
|
||||
ctnConstant = 82;
|
||||
|
||||
ctnBeginBlock = 90;
|
||||
ctnAsmBlock = 91;
|
||||
@ -142,7 +143,7 @@ const
|
||||
ctnRecordCase,ctnRecordVariant,
|
||||
ctnProcedureType,ctnSetType,ctnRangeType,ctnEnumerationType,
|
||||
ctnEnumIdentifier,ctnLabelType,ctnTypeType,ctnFileType,ctnPointerType,
|
||||
ctnClassOfType,ctnVariantType];
|
||||
ctnClassOfType,ctnVariantType,ctnConstant];
|
||||
AllPascalStatements = [ctnBeginBlock,ctnWithStatement,ctnWithVariable,
|
||||
ctnOnBlock,ctnOnIdentifier,ctnOnStatement];
|
||||
AllSourceTypes =
|
||||
@ -358,6 +359,7 @@ begin
|
||||
ctnSpecializeType: Result:='Specialize Typename';
|
||||
ctnSpecializeParams: Result:='Specialize Parameterlist';
|
||||
ctnGenericType: Result:='Generic Type';
|
||||
ctnConstant: Result:='Constant';
|
||||
|
||||
ctnWithVariable: Result:='With Variable';
|
||||
ctnWithStatement: Result:='With Statement';
|
||||
|
@ -2059,6 +2059,7 @@ var
|
||||
IdentStartPos, IdentEndPos: integer;
|
||||
IdentAdded: boolean;
|
||||
ClassStr: String;
|
||||
NodeStr: String;
|
||||
begin
|
||||
Result:='';
|
||||
if FindDeclaration(CursorPos,AllFindSmartFlags,
|
||||
@ -2099,16 +2100,23 @@ begin
|
||||
NewTool.ReadNextAtom;
|
||||
Result:=Result+': '+NewTool.GetAtom;
|
||||
end;
|
||||
|
||||
else
|
||||
DebugLn('ToDo: TFindDeclarationTool.FindSmartHint TypeNode=',
|
||||
TypeNode.DescAsString);
|
||||
ctnConstant:
|
||||
begin
|
||||
NodeStr:=' = '+NewTool.ExtractNode(TypeNode,[]);
|
||||
Result:=Result+copy(NodeStr,1,50);
|
||||
end;
|
||||
end;
|
||||
end else begin
|
||||
case NewNode.Desc of
|
||||
ctnConstDefinition:
|
||||
begin
|
||||
DebugLn('TFindDeclarationTool.FindSmartHint const without subnode "',NewTool.ExtractNode(NewNode,[]),'"');
|
||||
NodeStr:=NewTool.ExtractCode(NewNode.StartPos
|
||||
+GetIdentLen(@NewTool.Src[NewNode.StartPos]),
|
||||
NewNode.EndPos,[]);
|
||||
Result:=Result+copy(NodeStr,1,50);
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
if NewNode.Desc=ctnConstDefinition then begin
|
||||
|
||||
// ToDo: write value
|
||||
|
||||
end;
|
||||
end;
|
||||
|
||||
@ -2178,7 +2186,7 @@ begin
|
||||
end;
|
||||
end;
|
||||
// filename
|
||||
if Result<>'' then Result:=Result+#13#10;
|
||||
if Result<>'' then Result:=Result+LineEnding;
|
||||
Result:=Result+NewPos.Code.Filename;
|
||||
// file position
|
||||
if NewPos.Y>=1 then begin
|
||||
|
@ -2619,8 +2619,10 @@ begin
|
||||
if (CurPos.Flag<>cafEqual) then
|
||||
RaiseCharExpectedButAtomFound('=');
|
||||
// read constant
|
||||
ReadNextAtom;
|
||||
CreateChildNode;
|
||||
CurNode.Desc:=ctnConstant;
|
||||
repeat
|
||||
ReadNextAtom;
|
||||
if (CurPos.Flag in [cafRoundBracketOpen,cafEdgedBracketOpen]) then
|
||||
ReadTilBracketClose(true);
|
||||
if (CurPos.Flag in AllCommonAtomWords)
|
||||
@ -2628,7 +2630,13 @@ begin
|
||||
CurPos.StartPos,CurPos.EndPos-CurPos.StartPos))
|
||||
and AtomIsKeyWord then
|
||||
RaiseStringExpectedButAtomFound('constant');
|
||||
until (CurPos.Flag in [cafSemicolon]);
|
||||
if (CurPos.Flag=cafSemicolon) then break;
|
||||
CurNode.EndPos:=CurPos.EndPos;
|
||||
ReadNextAtom;
|
||||
until (CurPos.StartPos>SrcLen);
|
||||
// close ctnConstant node
|
||||
EndChildNode;
|
||||
// close ctnConstDefinition node
|
||||
CurNode.EndPos:=CurPos.EndPos;
|
||||
EndChildNode;
|
||||
end else begin
|
||||
|
@ -256,6 +256,7 @@ begin
|
||||
s:=IdentItem.Tool.ExtractCode(IdentItem.Node.StartPos+length(s),
|
||||
IdentItem.Node.EndPos,[]);
|
||||
end;
|
||||
s:=copy(s,1,50);
|
||||
end;
|
||||
|
||||
else
|
||||
|
Loading…
Reference in New Issue
Block a user