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