mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-06-01 12:32:33 +02:00
IDE, CodeTools: support {scopedenums on} in "case ofall" code template
git-svn-id: trunk@53039 -
This commit is contained in:
parent
8b5f7616e7
commit
c0cc369d3d
@ -487,7 +487,7 @@ type
|
||||
out ListOfPCodeXYPosition: TFPList;
|
||||
SkipAbstractsInStartClass: boolean = false): boolean;
|
||||
function GetValuesOfCaseVariable(Code: TCodeBuffer; X,Y: integer;
|
||||
List: TStrings): boolean;
|
||||
List: TStrings; WithTypeDefIfScoped: boolean): boolean;
|
||||
function GatherOverloads(Code: TCodeBuffer; X,Y: integer;
|
||||
out Graph: TDeclarationOverloadsGraph): boolean;
|
||||
|
||||
@ -2406,7 +2406,7 @@ begin
|
||||
end;
|
||||
|
||||
function TCodeToolManager.GetValuesOfCaseVariable(Code: TCodeBuffer; X,
|
||||
Y: integer; List: TStrings): boolean;
|
||||
Y: integer; List: TStrings; WithTypeDefIfScoped: boolean): boolean;
|
||||
var
|
||||
CursorPos: TCodeXYPosition;
|
||||
begin
|
||||
@ -2419,7 +2419,7 @@ begin
|
||||
CursorPos.Y:=Y;
|
||||
CursorPos.Code:=Code;
|
||||
try
|
||||
Result:=FCurCodeTool.GetValuesOfCaseVariable(CursorPos,List);
|
||||
Result:=FCurCodeTool.GetValuesOfCaseVariable(CursorPos,List,WithTypeDefIfScoped);
|
||||
except
|
||||
on e: Exception do Result:=HandleException(e);
|
||||
end;
|
||||
|
@ -432,7 +432,7 @@ type
|
||||
out ListOfPCodeXYPosition: TFPList;
|
||||
SkipAbstractsInStartClass: boolean = false): boolean;
|
||||
function GetValuesOfCaseVariable(const CursorPos: TCodeXYPosition;
|
||||
List: TStrings): boolean;
|
||||
List: TStrings; WithTypeDefIfScoped: boolean): boolean;
|
||||
property Beautifier: TBeautifyCodeOptions read FBeautifier write FBeautifier;
|
||||
|
||||
procedure CalcMemSize(Stats: TCTMemStats); override;
|
||||
@ -3400,7 +3400,8 @@ begin
|
||||
end;
|
||||
|
||||
function TIdentCompletionTool.GetValuesOfCaseVariable(
|
||||
const CursorPos: TCodeXYPosition; List: TStrings): boolean;
|
||||
const CursorPos: TCodeXYPosition; List: TStrings; WithTypeDefIfScoped: boolean
|
||||
): boolean;
|
||||
var
|
||||
CleanCursorPos: integer;
|
||||
CursorNode: TCodeTreeNode;
|
||||
@ -3410,6 +3411,7 @@ var
|
||||
ExprType: TExpressionType;
|
||||
Node: TCodeTreeNode;
|
||||
Tool: TFindDeclarationTool;
|
||||
EnumPrefix: string;
|
||||
begin
|
||||
Result:=false;
|
||||
ActivateGlobalWriteLock;
|
||||
@ -3467,9 +3469,18 @@ begin
|
||||
|
||||
ctnEnumerationType:
|
||||
begin
|
||||
if WithTypeDefIfScoped
|
||||
and (Tool.Scanner.GetDirectiveValueAt(sdScopedEnums, Node.StartPos) = '1') then
|
||||
begin
|
||||
Tool.MoveCursorToCleanPos(Node.Parent.StartPos);
|
||||
Tool.ReadNextAtom;
|
||||
EnumPrefix := Tool.GetAtom+'.';
|
||||
end else
|
||||
EnumPrefix := '';
|
||||
|
||||
Node:=Node.FirstChild;
|
||||
while Node<>nil do begin
|
||||
List.Add(GetIdentifier(@Tool.Src[Node.StartPos]));
|
||||
List.Add(EnumPrefix+GetIdentifier(@Tool.Src[Node.StartPos]));
|
||||
Node:=Node.NextBrother;
|
||||
end;
|
||||
end;
|
||||
|
@ -511,7 +511,7 @@ begin
|
||||
end;
|
||||
if not CodeToolBoss.GetValuesOfCaseVariable(
|
||||
SrcEdit.CodeToolsBuffer as TCodeBuffer,
|
||||
CaretXY.X,CaretXY.Y,List) then
|
||||
CaretXY.X,CaretXY.Y,List,True) then
|
||||
begin
|
||||
Result:=false;
|
||||
ErrorMsg:=CodeToolBoss.ErrorMessage;
|
||||
|
Loading…
Reference in New Issue
Block a user