Skip to content

Commit

Permalink
Include directives now show in function list
Browse files Browse the repository at this point in the history
  • Loading branch information
ollydev committed Oct 2, 2023
1 parent e2f9c44 commit a708ab6
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 18 deletions.
Binary file modified DocGen/images/icon.ico
Binary file not shown.
3 changes: 2 additions & 1 deletion Source/codetools/simba.ide_codetools_parser.pas
Original file line number Diff line number Diff line change
Expand Up @@ -589,6 +589,7 @@ constructor TDeclaration_IncludeDirective.Create(AParser: TCodeParser; AFileName
inherited Create(AParser, nil, AParser.Lexer.TokenPos, AParser.Lexer.TokenPos + AParser.Lexer.TokenLen);

FileName := AFileName;
Name := ChangeFileExt(ExtractFileName(FileName), '');
end;

constructor TDeclaration_Type.Create(AParser: TCodeParser; AOwner: TDeclaration; AStart: Integer; AEnd: Integer);
Expand Down Expand Up @@ -1324,7 +1325,7 @@ procedure TCodeParser.FindGlobals;
for I := 0 to FItems.Count - 1 do
begin
Decl := FItems[I];
if (Decl.Name = '') then
if (Decl.Name = '') or (Decl.ClassType = TDeclaration_IncludeDirective) then
Continue;

if (Decl is TDeclaration_Method) and Decl.isObjectMethod then
Expand Down
4 changes: 2 additions & 2 deletions Source/forms/simba.functionlistform.lfm
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
object SimbaFunctionListForm: TSimbaFunctionListForm
Left = 1145
Left = 1530
Height = 301
Top = 680
Top = 748
Width = 765
Caption = 'Function List'
DesignTimePPI = 120
Expand Down
30 changes: 15 additions & 15 deletions Source/forms/simba.functionlistform.pas
Original file line number Diff line number Diff line change
Expand Up @@ -87,15 +87,13 @@ implementation

function GetImage(const Decl: TDeclaration): Integer;
begin
//if (Decl is TDeclaration_Method) and Decl.isFunction then Result := IMG_FUNC else
//if (Decl is TDeclaration_Method) and Decl.isProcedure then Result := IMG_PROC else
//if (Decl is TDeclaration_Method) and Decl.isOperatorMethod then Result := IMG_FUNC else
if (Decl is TDeclaration_Method) then Result := IMG_FUNC else
if (Decl is TDeclaration_EnumElement) then Result := IMG_ENUM else
if (Decl is TDeclaration_Type) then Result := IMG_TYPE else
if (Decl is TDeclaration_Const) then Result := IMG_CONST else
if (Decl is TDeclaration_Var) then Result := IMG_VAR else
if (Decl is TDeclaration_Anchor) then Result := IMG_ANCHOR else
if (Decl is TDeclaration_Method) then Result := IMG_FUNC else
if (Decl is TDeclaration_EnumElement) then Result := IMG_ENUM else
if (Decl is TDeclaration_Type) then Result := IMG_TYPE else
if (Decl is TDeclaration_Const) then Result := IMG_CONST else
if (Decl is TDeclaration_Var) then Result := IMG_VAR else
if (Decl is TDeclaration_Anchor) then Result := IMG_ANCHOR else
if (Decl is TDeclaration_IncludeDirective) then Result := IMG_FILE else
Result := -1;
end;

Expand All @@ -121,11 +119,13 @@ function GetHint(const Decl: TDeclaration): String;
else
Result := Decl.Name
else
if (Decl is TDeclaration_Method) then Result := TDeclaration_Method(Decl).HeaderString else
if (Decl is TDeclaration_Type) then Result := 'type ' + Decl.Name + ' = ' + Decl.TextNoCommentsSingleLine else
if (Decl is TDeclaration_Const) then Result := 'const ' + Decl.Name + TDeclaration_Var(Decl).VarTypeString + TDeclaration_Var(Decl).VarDefaultString else
if (Decl is TDeclaration_Var) then Result := 'var ' + Decl.Name + TDeclaration_Var(Decl).VarTypeString + TDeclaration_Var(Decl).VarDefaultString else
if (Decl is TDeclaration_Anchor) then Result := 'Anchor "' + Decl.Name + '"' else
if (Decl is TDeclaration_Method) then Result := TDeclaration_Method(Decl).HeaderString else
if (Decl is TDeclaration_Type) then Result := 'type ' + Decl.Name + ' = ' + Decl.TextNoCommentsSingleLine else
if (Decl is TDeclaration_Const) then Result := 'const ' + Decl.Name + TDeclaration_Var(Decl).VarTypeString + TDeclaration_Var(Decl).VarDefaultString else
if (Decl is TDeclaration_Var) then Result := 'var ' + Decl.Name + TDeclaration_Var(Decl).VarTypeString + TDeclaration_Var(Decl).VarDefaultString else
if (Decl is TDeclaration_Anchor) then Result := 'Anchor "' + Decl.Name + '"' else
if (Decl is TDeclaration_IncludeDirective) then Result := TDeclaration_IncludeDirective(Decl).FileName
else
Result := '';
end;

Expand Down Expand Up @@ -291,7 +291,7 @@ procedure TSimbaFunctionListForm.Fill;
begin
RunInMainThread(@BeginUpdate);

if CanUpdate then
if {%H-}CanUpdate then
begin
FCodeInsight.SetScript(Script, ScriptFileName);
FCodeInsight.Run();
Expand Down

0 comments on commit a708ab6

Please sign in to comment.