Skip to content

Commit 866edac

Browse files
committed
feature/add-vs-code-integration
1 parent 6b68c41 commit 866edac

12 files changed

+69
-33
lines changed

Src/Consts/C4D.Wizard.Consts.pas

+2
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,8 @@ TC4DConsts = class
111111
MENU_IDE_VSCODE_INTEGRATION_INSTALL_DELPHILSP_CAPTION = 'Install DelphiLSP extension in VS Code';
112112
MENU_IDE_VSCODE_INTEGRATION_INSTALL_GithubCopilot_NAME = 'C4DWizarVsCodeIntegrationInstallGithubCopilot1';
113113
MENU_IDE_VSCODE_INTEGRATION_INSTALL_GithubCopilot_CAPTION = 'Install GitHub Copilot extension in VS Code';
114+
MENU_IDE_VSCODE_INTEGRATION_INSTALL_Supermaven_NAME = 'C4DWizarVsCodeIntegrationInstallSupermaven1';
115+
MENU_IDE_VSCODE_INTEGRATION_INSTALL_Supermaven_CAPTION = 'Install GitHub Supermaven extension in VS Code';
114116

115117
//FILE .INI REOPEN
116118
REOPEN_INI_Favorite = 'Favorite';

Src/IDE/CompileNotifier/C4D.Wizard.IDE.CompileNotifier.pas

+8-2
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@ implementation
2828
C4D.Wizard.Consts,
2929
C4D.Wizard.Utils,
3030
C4D.Wizard.Utils.OTA,
31-
C4D.Wizard.Settings.Model;
31+
C4D.Wizard.Settings.Model,
32+
C4D.Wizard.ProcessDelphi;
3233

3334
var
3435
IndexNotifier: Integer = -1;
@@ -53,6 +54,7 @@ procedure TC4DWizardIDECompileNotifier.ProjectCompileStarted(const Project: IOTA
5354
var
5455
LIOTAProject: IOTAProject;
5556
LCurrentBinaryPath: string;
57+
LCommand: string;
5658
begin
5759
if(not C4DWizardSettingsModel.BeforeCompilingCheckRunning)then
5860
Exit;
@@ -67,8 +69,12 @@ procedure TC4DWizardIDECompileNotifier.ProjectCompileStarted(const Project: IOTA
6769
begin
6870
if(TC4DWizardUtils.ProcessWindowsExists(ExtractFileName(LCurrentBinaryPath), LCurrentBinaryPath))then
6971
begin
70-
if(not TC4DWizardUtils.ShowQuestion2('The application is already running, do you wish to continue?'))then
72+
if(not TC4DWizardUtils.ShowQuestion2('The application is already running, do you wish to continue (Kills current process)?'))then
7173
Abort;
74+
75+
LCommand := 'taskkill /f /IM ' + ExtractFileName(Project.ProjectOptions.TargetName);
76+
TC4DWizardProcessDelphi.RunCommand([LCommand]);
77+
Sleep(1000);
7278
end;
7379
end;
7480
end;

Src/IDE/MainMenu/C4D.Wizard.IDE.MainMenu.Clicks.pas

+10-3
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,9 @@ TC4DWizardIDEMainMenuClicks = class
2222
class procedure ReplaceClick(Sender: TObject);
2323
class procedure NotesClick(Sender: TObject);
2424
class procedure VsCodeIntegrationOpenInVsCodeClick(Sender: TObject);
25-
class procedure VsCodeIntegrationInstallGithubCopilotClick(Sender: TObject);
2625
class procedure VsCodeIntegrationInstallDelphiLSPClick(Sender: TObject);
26+
class procedure VsCodeIntegrationInstallGithubCopilotClick(Sender: TObject);
27+
class procedure VsCodeIntegrationInstallSupermavenClick(Sender: TObject);
2728
class procedure DefaultFilesInOpeningProjectClick(Sender: TObject);
2829
class procedure BackupExportClick(Sender: TObject);
2930
class procedure BackupImportClick(Sender: TObject);
@@ -141,14 +142,20 @@ class procedure TC4DWizardIDEMainMenuClicks.VsCodeIntegrationOpenInVsCodeClick(S
141142
TC4DWizardVsCodeIntegration.Open;
142143
end;
143144

145+
class procedure TC4DWizardIDEMainMenuClicks.VsCodeIntegrationInstallDelphiLSPClick(Sender: TObject);
146+
begin
147+
TC4DWizardVsCodeIntegration.InstallDelphiLSP;
148+
end;
149+
150+
144151
class procedure TC4DWizardIDEMainMenuClicks.VsCodeIntegrationInstallGithubCopilotClick(Sender: TObject);
145152
begin
146153
TC4DWizardVsCodeIntegration.InstallGithubCopilot;
147154
end;
148155

149-
class procedure TC4DWizardIDEMainMenuClicks.VsCodeIntegrationInstallDelphiLSPClick(Sender: TObject);
156+
class procedure TC4DWizardIDEMainMenuClicks.VsCodeIntegrationInstallSupermavenClick(Sender: TObject);
150157
begin
151-
TC4DWizardVsCodeIntegration.InstallDelphiLSP;
158+
TC4DWizardVsCodeIntegration.InstallSupermaven;
152159
end;
153160

154161
class procedure TC4DWizardIDEMainMenuClicks.DefaultFilesInOpeningProjectClick(Sender: TObject);

Src/IDE/MainMenu/C4D.Wizard.IDE.MainMenu.VsCodeIntegration.pas

+24-10
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,9 @@ TC4DWizardIDEMainMenuVsCodeIntegration = class(TInterfacedObject, IC4DWizardID
2020
procedure AddMenuVsCodeIntegration;
2121
procedure AddSubMenuItemOpen;
2222
procedure AddSeparator(AName: string);
23-
procedure AddSubMenuInstallGithubCopilot;
2423
procedure AddSubMenuInstallDelphiLSP;
24+
procedure AddSubMenuInstallGithubCopilot;
25+
procedure AddSubMenuInstallSupermaven;
2526
function GetShortcutOpenInVsCode: string;
2627
protected
2728
function Process: IC4DWizardIDEMainMenuVsCodeIntegration;
@@ -54,8 +55,9 @@ function TC4DWizardIDEMainMenuVsCodeIntegration.Process: IC4DWizardIDEMainMenuVs
5455
Self.AddMenuVsCodeIntegration;
5556
Self.AddSubMenuItemOpen;
5657
Self.AddSeparator('C4DVsCodeIntegrationSeparator01');
57-
Self.AddSubMenuInstallGithubCopilot;
5858
Self.AddSubMenuInstallDelphiLSP;
59+
Self.AddSubMenuInstallGithubCopilot;
60+
Self.AddSubMenuInstallSupermaven;
5961
end;
6062

6163
procedure TC4DWizardIDEMainMenuVsCodeIntegration.AddSeparator(AName: string);
@@ -92,27 +94,27 @@ procedure TC4DWizardIDEMainMenuVsCodeIntegration.AddSubMenuItemOpen;
9294
FMenuItemVsCodeIntegration.Add(LMenuItem);
9395
end;
9496

95-
procedure TC4DWizardIDEMainMenuVsCodeIntegration.AddSubMenuInstallGithubCopilot;
97+
procedure TC4DWizardIDEMainMenuVsCodeIntegration.AddSubMenuInstallDelphiLSP;
9698
var
9799
LMenuItem: TMenuItem;
98100
begin
99101
LMenuItem := TMenuItem.Create(FMenuItemVsCodeIntegration);
100-
LMenuItem.Name := TC4DConsts.MENU_IDE_VSCODE_INTEGRATION_INSTALL_GithubCopilot_NAME;
101-
LMenuItem.Caption := TC4DConsts.MENU_IDE_VSCODE_INTEGRATION_INSTALL_GithubCopilot_CAPTION;
102+
LMenuItem.Name := TC4DConsts.MENU_IDE_VSCODE_INTEGRATION_INSTALL_DELPHILSP_NAME;
103+
LMenuItem.Caption := TC4DConsts.MENU_IDE_VSCODE_INTEGRATION_INSTALL_DELPHILSP_CAPTION;
102104
LMenuItem.ImageIndex := TC4DWizardIDEImageListMain.GetInstance.ImgIndexImport;
103-
LMenuItem.OnClick := TC4DWizardIDEMainMenuClicks.VsCodeIntegrationInstallGithubCopilotClick;
105+
LMenuItem.OnClick := TC4DWizardIDEMainMenuClicks.VsCodeIntegrationInstallDelphiLSPClick;
104106
FMenuItemVsCodeIntegration.Add(LMenuItem);
105107
end;
106108

107-
procedure TC4DWizardIDEMainMenuVsCodeIntegration.AddSubMenuInstallDelphiLSP;
109+
procedure TC4DWizardIDEMainMenuVsCodeIntegration.AddSubMenuInstallGithubCopilot;
108110
var
109111
LMenuItem: TMenuItem;
110112
begin
111113
LMenuItem := TMenuItem.Create(FMenuItemVsCodeIntegration);
112-
LMenuItem.Name := TC4DConsts.MENU_IDE_VSCODE_INTEGRATION_INSTALL_DELPHILSP_NAME;
113-
LMenuItem.Caption := TC4DConsts.MENU_IDE_VSCODE_INTEGRATION_INSTALL_DELPHILSP_CAPTION;
114+
LMenuItem.Name := TC4DConsts.MENU_IDE_VSCODE_INTEGRATION_INSTALL_GithubCopilot_NAME;
115+
LMenuItem.Caption := TC4DConsts.MENU_IDE_VSCODE_INTEGRATION_INSTALL_GithubCopilot_CAPTION;
114116
LMenuItem.ImageIndex := TC4DWizardIDEImageListMain.GetInstance.ImgIndexImport;
115-
LMenuItem.OnClick := TC4DWizardIDEMainMenuClicks.VsCodeIntegrationInstallDelphiLSPClick;
117+
LMenuItem.OnClick := TC4DWizardIDEMainMenuClicks.VsCodeIntegrationInstallGithubCopilotClick;
116118
FMenuItemVsCodeIntegration.Add(LMenuItem);
117119
end;
118120

@@ -123,4 +125,16 @@ function TC4DWizardIDEMainMenuVsCodeIntegration.GetShortcutOpenInVsCode: string;
123125
Result := C4DWizardSettingsModel.ShortcutVsCodeIntegrationOpen.Trim;
124126
end;
125127

128+
procedure TC4DWizardIDEMainMenuVsCodeIntegration.AddSubMenuInstallSupermaven;
129+
var
130+
LMenuItem: TMenuItem;
131+
begin
132+
LMenuItem := TMenuItem.Create(FMenuItemVsCodeIntegration);
133+
LMenuItem.Name := TC4DConsts.MENU_IDE_VSCODE_INTEGRATION_INSTALL_Supermaven_NAME;
134+
LMenuItem.Caption := TC4DConsts.MENU_IDE_VSCODE_INTEGRATION_INSTALL_Supermaven_CAPTION;
135+
LMenuItem.ImageIndex := TC4DWizardIDEImageListMain.GetInstance.ImgIndexImport;
136+
LMenuItem.OnClick := TC4DWizardIDEMainMenuClicks.VsCodeIntegrationInstallSupermavenClick;
137+
FMenuItemVsCodeIntegration.Add(LMenuItem);
138+
end;
139+
126140
end.

Src/OpenExternal/C4D.Wizard.OpenExternal.AddEdit.View.dfm

-1
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,6 @@ object C4DWizardOpenExternalAddEditView: TC4DWizardOpenExternalAddEditView
103103
BevelOuter = bvNone
104104
ParentBackground = False
105105
TabOrder = 1
106-
ExplicitTop = -3
107106
DesignSize = (
108107
676
109108
412)

Src/OpenExternal/C4D.Wizard.OpenExternal.View.dfm

+1
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,7 @@ object C4DWizardOpenExternalView: TC4DWizardOpenExternalView
209209
Caption = 'Search'
210210
TabOrder = 0
211211
OnClick = btnSearchClick
212+
ExplicitTop = 11
212213
end
213214
object edtSearch: TEdit
214215
AlignWithMargins = True

Src/Reopen/C4D.Wizard.Reopen.View.Edit.pas

+2-2
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ procedure TC4DWizardReopenViewEdit.FillFields;
100100
LFolderGit: string;
101101
begin
102102
mmFilePath.Lines.Text := FC4DWizardReopenData.FilePath;
103-
ColorBox1.Selected := TC4DWizardUtils.stringToColorDef(FC4DWizardReopenData.Color);
103+
ColorBox1.Selected := TC4DWizardUtils.StringToColorDef(FC4DWizardReopenData.Color);
104104

105105
edtNickname.Text := FC4DWizardReopenData.Nickname;
106106
if(Trim(edtNickname.Text).IsEmpty)then
@@ -120,7 +120,7 @@ procedure TC4DWizardReopenViewEdit.FillFields;
120120
procedure TC4DWizardReopenViewEdit.btnConfirmClick(Sender: TObject);
121121
begin
122122
FC4DWizardReopenData.Nickname := edtNickname.Text;
123-
FC4DWizardReopenData.Color := ColorTostring(ColorBox1.Selected);
123+
FC4DWizardReopenData.Color := ColorToString(ColorBox1.Selected);
124124
FC4DWizardReopenData.FolderGit := Trim(edtFolderGit.Text);
125125
if(cBoxGroup.ItemIndex >= 0)then
126126
FC4DWizardReopenData.GuidGroup := TC4DWizardGroups(cBoxGroup.Items.Objects[cBoxGroup.ItemIndex]).Guid;

Src/Reopen/C4D.Wizard.Reopen.View.dfm

+1
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@ object C4DWizardReopenView: TC4DWizardReopenView
9393
Images = ImageList1
9494
TabOrder = 0
9595
OnClick = btnSearchClick
96+
ExplicitLeft = 807
9697
end
9798
object edtSearch: TEdit
9899
AlignWithMargins = True

Src/Reopen/C4D.Wizard.Reopen.View.pas

+1-1
Original file line numberDiff line numberDiff line change
@@ -350,7 +350,7 @@ procedure TC4DWizardReopenView.ListViewHistoryCustomDrawSubItem(Sender: TCustomL
350350
LColorStr := Item.SubItems[C_INDEX_SUBITEM_Color].Trim;
351351
if(not LColorStr.IsEmpty)then
352352
begin
353-
LColor := TC4DWizardUtils.stringToColorDef(LColorStr);
353+
LColor := TC4DWizardUtils.StringToColorDef(LColorStr);
354354
if(LColor <> clBlack)then
355355
Sender.Canvas.Font.Color := LColor
356356
end;

Src/Utils/C4D.Wizard.Utils.OTA.pas

+2-2
Original file line numberDiff line numberDiff line change
@@ -168,13 +168,13 @@ class function TC4DWizardUtilsOTA.AddImgIDEResourceName(AResourceName: string):
168168
LMaskColor: TColor;
169169
begin
170170
Result := -1;
171-
if(FindResource(hInstance, PChar(AResourceName), RT_BITMAP) <= 0)then
171+
if(FindResource(HInstance, PChar(AResourceName), RT_BITMAP) <= 0)then
172172
Exit;
173173

174174
LBitmap := TBitmap.Create;
175175
try
176176
try
177-
LBitmap.LoadFromResourceName(hInstance, AResourceName);
177+
LBitmap.LoadFromResourceName(HInstance, AResourceName);
178178
{$IF CompilerVersion = 35} //Alexandria
179179
LMaskColor := clLime;
180180
{$ELSE}

Src/Utils/C4D.Wizard.Utils.pas

+3-3
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ TC4DWizardUtils = class
5555
class function SelectFile(const ADefaultExt: TC4DExtensionsFiles): string; overload;
5656
class function SelectFile(const ADefaultFile: string; const ADefaultExt: TC4DExtensionsFiles): string; overload;
5757
class function SelectFolder(const ADefaultFolder: string; const ADefaultFolderIfCancel: Boolean = True): string;
58-
class function stringToColorDef(AValue: string; AColorDefault: TColor = clBlack): TColor;
58+
class function StringToColorDef(AValue: string; AColorDefault: TColor = clBlack): TColor;
5959
class function DateTimeToStrEmpty(AValue: TDateTime): string;
6060
class function IncInt(var AValue: Integer): Integer;
6161
class procedure OpenFile(AFilePath: string);
@@ -498,10 +498,10 @@ class function TC4DWizardUtils.SelectFolder(const ADefaultFolder: string; const
498498
end;
499499
{$WARN SYMBOL_PLATFORM ON}
500500

501-
class function TC4DWizardUtils.stringToColorDef(AValue: string; AColorDefault: TColor = clBlack): TColor;
501+
class function TC4DWizardUtils.StringToColorDef(AValue: string; AColorDefault: TColor = clBlack): TColor;
502502
begin
503503
try
504-
Result := stringToColor(AValue)
504+
Result := StringToColor(AValue)
505505
except
506506
Result := AColorDefault;
507507
end;

Src/VsCodeIntegration/C4D.Wizard.VsCodeIntegration.pas

+15-9
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,9 @@ TC4DWizardVsCodeIntegration = class
1212
class procedure RunCommandInstallExtension(const AIdentifierExtension: string);
1313
public
1414
class procedure Open;
15-
class procedure InstallGithubCopilot;
1615
class procedure InstallDelphiLSP;
16+
class procedure InstallGithubCopilot;
17+
class procedure InstallSupermaven;
1718
end;
1819

1920
implementation
@@ -33,7 +34,7 @@ class procedure TC4DWizardVsCodeIntegration.Open;
3334
LIOTAProject: IOTAProject;
3435
LFilePathProject: string;
3536
LCursorPos: TOTAEditPos;
36-
LComand: string;
37+
LCommand: string;
3738
begin
3839
LIOTAModuleServices := TC4DWizardUtilsOTA.GetIOTAModuleServices;
3940

@@ -59,29 +60,34 @@ class procedure TC4DWizardVsCodeIntegration.Open;
5960

6061
LCursorPos := LIOTAEditView.CursorPos;
6162
//REFERENCE: https://code.visualstudio.com/docs/editor/command-line
62-
LComand := Format('"code -n %s -g %s:%d:%d"', [LFilePathProject, LFileNameModule, LCursorPos.Line, LCursorPos.Col]);
63-
TC4DWizardProcessDelphi.RunCommand([LComand]);
63+
LCommand := Format('"code -n %s -g %s:%d:%d"', [LFilePathProject, LFileNameModule, LCursorPos.Line, LCursorPos.Col]);
64+
TC4DWizardProcessDelphi.RunCommand([LCommand]);
65+
end;
66+
67+
class procedure TC4DWizardVsCodeIntegration.InstallDelphiLSP;
68+
begin
69+
Self.RunCommandInstallExtension('embarcaderotechnologies.delphilsp');
6470
end;
6571

6672
class procedure TC4DWizardVsCodeIntegration.InstallGithubCopilot;
6773
begin
6874
Self.RunCommandInstallExtension('github.copilot');
6975
end;
7076

71-
class procedure TC4DWizardVsCodeIntegration.InstallDelphiLSP;
77+
class procedure TC4DWizardVsCodeIntegration.InstallSupermaven;
7278
begin
73-
Self.RunCommandInstallExtension('embarcaderotechnologies.delphilsp');
79+
Self.RunCommandInstallExtension('supermaven.supermaven');
7480
end;
7581

7682
class procedure TC4DWizardVsCodeIntegration.RunCommandInstallExtension(const AIdentifierExtension: string);
7783
var
78-
LComand: string;
84+
LCommand: string;
7985
begin
8086
if AIdentifierExtension.Trim.IsEmpty then
8187
Exit;
8288

83-
LComand := Format('"code --install-extension %s --force"', [AIdentifierExtension]);
84-
TC4DWizardProcessDelphi.RunCommand([LComand]);
89+
LCommand := Format('"code --install-extension %s --force"', [AIdentifierExtension]);
90+
TC4DWizardProcessDelphi.RunCommand([LCommand]);
8591

8692
TC4DWizardUtils.ShowMsg('Extension installation pushed to VS Code!');
8793
end;

0 commit comments

Comments
 (0)