-
Notifications
You must be signed in to change notification settings - Fork 17
Expand file tree
/
Copy pathPluginSettings.pas
More file actions
613 lines (535 loc) · 18.8 KB
/
PluginSettings.pas
File metadata and controls
613 lines (535 loc) · 18.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
unit PluginSettings;
interface
uses
System.Generics.Collections,
System.SysUtils,
System.Classes,
System.JSON,
System.IOUtils,
Vcl.Menus;
const
SETTINGS_FORMAT_VERSION = 2;
DEFAULT_WINDOW_CLASS_NAME = 'Chrome_WidgetWin_1';
DEFAULT_VSCODE_COMMAND = 'code';
DEFAULT_SHORTCUT_TEXT = 'Ctrl+\';
DEFAULT_REUSE_OPEN_ARGS = '--reuse-window {workspacePath}';
DEFAULT_REUSE_GOTO_ARGS = '--reuse-window {workspacePath} -g {gotoTarget}';
DEFAULT_NEW_OPEN_ARGS = '--new-window {workspacePath}';
DEFAULT_NEW_GOTO_ARGS = '--new-window {workspacePath} -g {gotoTarget}';
DEFAULT_DELPHI_LSP_ARGS = '--command delphilsp.selectSettingsFile';
type
TShortcutChangedProc = reference to procedure(AShortcut: TShortCut);
TSettingsChangedProc = reference to procedure;
TEditorSettings = class
strict private
FId: string;
FDisplayName: string;
FHomepageUrl: string;
FEnabled: Boolean;
FCommand: string;
FShortcut: TShortCut;
FWindowClassName: string;
FWindowTitleSuffix: string;
FReuseOpenArgs: string;
FReuseGotoArgs: string;
FNewOpenArgs: string;
FNewGotoArgs: string;
FDelphiLspArgs: string;
public
constructor Create(const AId, ADisplayName, AHomepageUrl: string; AEnabled: Boolean;
const ACommand: string; AShortcut: TShortCut; const AWindowClassName,
AWindowTitleSuffix, AReuseOpenArgs, AReuseGotoArgs, ANewOpenArgs,
ANewGotoArgs, ADelphiLspArgs: string);
procedure AssignFrom(Source: TEditorSettings; IncludeIdentity: Boolean = False);
function Clone: TEditorSettings;
procedure LoadFromJson(JsonObject: TJSONObject; LoadIdentity: Boolean = False);
function ToJson: TJSONObject;
property Id: string read FId;
property DisplayName: string read FDisplayName write FDisplayName;
property HomepageUrl: string read FHomepageUrl write FHomepageUrl;
property Enabled: Boolean read FEnabled write FEnabled;
property Command: string read FCommand write FCommand;
property Shortcut: TShortCut read FShortcut write FShortcut;
property WindowClassName: string read FWindowClassName write FWindowClassName;
property WindowTitleSuffix: string read FWindowTitleSuffix write FWindowTitleSuffix;
property ReuseOpenArgs: string read FReuseOpenArgs write FReuseOpenArgs;
property ReuseGotoArgs: string read FReuseGotoArgs write FReuseGotoArgs;
property NewOpenArgs: string read FNewOpenArgs write FNewOpenArgs;
property NewGotoArgs: string read FNewGotoArgs write FNewGotoArgs;
property DelphiLspArgs: string read FDelphiLspArgs write FDelphiLspArgs;
end;
/// Persists the plugin's user-configurable settings.
///
/// The current on-disk format stores multiple built-in editor profiles plus
/// optional custom editors. For backwards compatibility, the existing
/// VSCodeCommand and Shortcut properties still map to the built-in VS Code
/// profile so the rest of the plugin can keep working unchanged while the
/// broader multi-editor rollout is implemented in subsequent phases.
///
TPluginSettings = class
strict private
class var FBuiltInEditors: TObjectList<TEditorSettings>;
class var FCustomEditors: TObjectList<TEditorSettings>;
class var FOnShortcutChanged: TShortcutChangedProc;
class var FOnSettingsChanged: TSettingsChangedProc;
class function SettingsFilePath: string; static;
class procedure ResetToDefaults; static;
class procedure AddDefaultBuiltInEditors; static;
class function CreateBuiltInEditor(const EditorId, DisplayName, HomepageUrl,
Command, WindowTitleSuffix: string; Enabled: Boolean; Shortcut: TShortCut): TEditorSettings; static;
class function CreateCustomEditorFromJson(JsonObject: TJSONObject): TEditorSettings; static;
class function FindBuiltInEditor(const EditorId: string): TEditorSettings; static;
class function GetVSCodeEditor: TEditorSettings; static;
class function GetVSCodeCommand: string; static;
class procedure SetVSCodeCommand(const Value: string); static;
class function GetVSCodeShortcut: TShortCut; static;
class procedure SetVSCodeShortcut(const Value: TShortCut); static;
class procedure LoadLegacySettings(Root: TJSONObject); static;
class procedure LoadNewSettings(Root: TJSONObject); static;
class constructor Create;
class destructor Destroy;
public
class property VSCodeCommand: string read GetVSCodeCommand write SetVSCodeCommand;
class property Shortcut: TShortCut read GetVSCodeShortcut write SetVSCodeShortcut;
/// <summary>
/// Called by the IDE Options frame after saving, so the menu action
/// can update its shortcut without a circular unit dependency.
/// </summary>
class property OnShortcutChanged: TShortcutChangedProc
read FOnShortcutChanged write FOnShortcutChanged;
class property OnSettingsChanged: TSettingsChangedProc
read FOnSettingsChanged write FOnSettingsChanged;
/// <summary>Loads settings from disk. Missing or unreadable file leaves defaults intact.</summary>
class procedure Load;
/// <summary>Persists current settings to disk, creating the directory if needed.</summary>
class procedure Save;
/// <summary>Fires OnShortcutChanged if assigned.</summary>
class procedure NotifyShortcutChanged;
class procedure NotifySettingsChanged;
class function CreateDefaultBuiltInEditorCopy(const EditorId: string): TEditorSettings;
class function CreateNewCustomEditor(const DisplayName: string): TEditorSettings;
class procedure ReplaceCustomEditors(SourceEditors: TObjectList<TEditorSettings>);
class function BuiltInEditors: TArray<TEditorSettings>;
class function CustomEditors: TArray<TEditorSettings>;
end;
implementation
function ParseStoredShortcutText(const ShortcutText: string; DefaultValue: TShortCut): TShortCut;
begin
if ShortcutText = '' then begin
Result := 0;
Exit;
end;
var ParsedShortcut := TextToShortCut(ShortcutText);
if ParsedShortcut = 0 then begin
Result := DefaultValue;
Exit;
end;
Result := ParsedShortcut;
end;
function ShortcutToStoredText(AShortCut: TShortCut): string;
begin
if AShortCut = 0 then begin
Result := '';
Exit;
end;
Result := ShortCutToText(AShortCut);
end;
{ TEditorSettings }
constructor TEditorSettings.Create(const AId, ADisplayName, AHomepageUrl: string;
AEnabled: Boolean; const ACommand: string; AShortcut: TShortCut;
const AWindowClassName, AWindowTitleSuffix, AReuseOpenArgs, AReuseGotoArgs,
ANewOpenArgs, ANewGotoArgs, ADelphiLspArgs: string);
begin
inherited Create;
FId := AId;
FDisplayName := ADisplayName;
FHomepageUrl := AHomepageUrl;
FEnabled := AEnabled;
FCommand := ACommand;
FShortcut := AShortcut;
FWindowClassName := AWindowClassName;
FWindowTitleSuffix := AWindowTitleSuffix;
FReuseOpenArgs := AReuseOpenArgs;
FReuseGotoArgs := AReuseGotoArgs;
FNewOpenArgs := ANewOpenArgs;
FNewGotoArgs := ANewGotoArgs;
FDelphiLspArgs := ADelphiLspArgs;
end;
procedure TEditorSettings.AssignFrom(Source: TEditorSettings; IncludeIdentity: Boolean = False);
begin
if Source = nil then
Exit;
if IncludeIdentity then
FId := Source.Id;
FDisplayName := Source.DisplayName;
FHomepageUrl := Source.HomepageUrl;
FEnabled := Source.Enabled;
FCommand := Source.Command;
FShortcut := Source.Shortcut;
FWindowClassName := Source.WindowClassName;
FWindowTitleSuffix := Source.WindowTitleSuffix;
FReuseOpenArgs := Source.ReuseOpenArgs;
FReuseGotoArgs := Source.ReuseGotoArgs;
FNewOpenArgs := Source.NewOpenArgs;
FNewGotoArgs := Source.NewGotoArgs;
FDelphiLspArgs := Source.DelphiLspArgs;
end;
function TEditorSettings.Clone: TEditorSettings;
begin
Result := TEditorSettings.Create(
FId,
FDisplayName,
FHomepageUrl,
FEnabled,
FCommand,
FShortcut,
FWindowClassName,
FWindowTitleSuffix,
FReuseOpenArgs,
FReuseGotoArgs,
FNewOpenArgs,
FNewGotoArgs,
FDelphiLspArgs);
end;
procedure TEditorSettings.LoadFromJson(JsonObject: TJSONObject; LoadIdentity: Boolean = False);
begin
if JsonObject = nil then
Exit;
var JsonValue: TJSONValue;
if LoadIdentity then begin
JsonValue := JsonObject.GetValue('id');
if JsonValue <> nil then
FId := JsonValue.Value;
end;
JsonValue := JsonObject.GetValue('displayName');
if JsonValue <> nil then
FDisplayName := JsonValue.Value;
JsonValue := JsonObject.GetValue('homepageUrl');
if JsonValue <> nil then
FHomepageUrl := JsonValue.Value;
JsonValue := JsonObject.GetValue('enabled');
if JsonValue <> nil then
FEnabled := SameText(JsonValue.Value, 'true');
JsonValue := JsonObject.GetValue('command');
if JsonValue <> nil then
FCommand := JsonValue.Value;
JsonValue := JsonObject.GetValue('shortcut');
if JsonValue <> nil then
FShortcut := ParseStoredShortcutText(JsonValue.Value, FShortcut);
JsonValue := JsonObject.GetValue('windowClassName');
if JsonValue <> nil then
FWindowClassName := JsonValue.Value;
JsonValue := JsonObject.GetValue('windowTitleSuffix');
if JsonValue <> nil then
FWindowTitleSuffix := JsonValue.Value;
JsonValue := JsonObject.GetValue('reuseOpenArgs');
if JsonValue <> nil then
FReuseOpenArgs := JsonValue.Value;
JsonValue := JsonObject.GetValue('reuseGotoArgs');
if JsonValue <> nil then
FReuseGotoArgs := JsonValue.Value;
JsonValue := JsonObject.GetValue('newOpenArgs');
if JsonValue <> nil then
FNewOpenArgs := JsonValue.Value;
JsonValue := JsonObject.GetValue('newGotoArgs');
if JsonValue <> nil then
FNewGotoArgs := JsonValue.Value;
JsonValue := JsonObject.GetValue('delphiLspArgs');
if JsonValue <> nil then
FDelphiLspArgs := JsonValue.Value;
end;
function TEditorSettings.ToJson: TJSONObject;
begin
Result := TJSONObject.Create;
Result.AddPair('id', FId);
Result.AddPair('displayName', FDisplayName);
Result.AddPair('homepageUrl', FHomepageUrl);
Result.AddPair('enabled', TJSONBool.Create(FEnabled));
Result.AddPair('command', FCommand);
Result.AddPair('shortcut', ShortcutToStoredText(FShortcut));
Result.AddPair('windowClassName', FWindowClassName);
Result.AddPair('windowTitleSuffix', FWindowTitleSuffix);
Result.AddPair('reuseOpenArgs', FReuseOpenArgs);
Result.AddPair('reuseGotoArgs', FReuseGotoArgs);
Result.AddPair('newOpenArgs', FNewOpenArgs);
Result.AddPair('newGotoArgs', FNewGotoArgs);
Result.AddPair('delphiLspArgs', FDelphiLspArgs);
end;
{ TPluginSettings }
class constructor TPluginSettings.Create;
begin
FBuiltInEditors := TObjectList<TEditorSettings>.Create(True);
FCustomEditors := TObjectList<TEditorSettings>.Create(True);
ResetToDefaults;
end;
class destructor TPluginSettings.Destroy;
begin
FBuiltInEditors.Free;
FCustomEditors.Free;
end;
class function TPluginSettings.SettingsFilePath: string;
begin
Result := TPath.Combine(
TPath.Combine(GetEnvironmentVariable('APPDATA'), 'EditInVSCode'),
'settings.json');
end;
class procedure TPluginSettings.ResetToDefaults;
begin
FBuiltInEditors.Clear;
FCustomEditors.Clear;
AddDefaultBuiltInEditors;
end;
class procedure TPluginSettings.AddDefaultBuiltInEditors;
begin
for var EditorId in ['vscode', 'cursor', 'windsurf', 'trae', 'vscodium'] do
FBuiltInEditors.Add(CreateDefaultBuiltInEditorCopy(EditorId));
end;
class function TPluginSettings.CreateBuiltInEditor(const EditorId, DisplayName,
HomepageUrl, Command, WindowTitleSuffix: string; Enabled: Boolean;
Shortcut: TShortCut): TEditorSettings;
begin
Result := TEditorSettings.Create(
EditorId,
DisplayName,
HomepageUrl,
Enabled,
Command,
Shortcut,
DEFAULT_WINDOW_CLASS_NAME,
WindowTitleSuffix,
DEFAULT_REUSE_OPEN_ARGS,
DEFAULT_REUSE_GOTO_ARGS,
DEFAULT_NEW_OPEN_ARGS,
DEFAULT_NEW_GOTO_ARGS,
DEFAULT_DELPHI_LSP_ARGS);
end;
class function TPluginSettings.CreateCustomEditorFromJson(JsonObject: TJSONObject): TEditorSettings;
begin
Result := TEditorSettings.Create(
'', '', '', False, '', 0, DEFAULT_WINDOW_CLASS_NAME, '',
DEFAULT_REUSE_OPEN_ARGS, DEFAULT_REUSE_GOTO_ARGS,
DEFAULT_NEW_OPEN_ARGS, DEFAULT_NEW_GOTO_ARGS, '');
Result.LoadFromJson(JsonObject, True);
end;
class function TPluginSettings.CreateDefaultBuiltInEditorCopy(const EditorId: string): TEditorSettings;
begin
if SameText(EditorId, 'vscode') then begin
Result := CreateBuiltInEditor(
'vscode', 'Visual Studio Code', 'https://code.visualstudio.com/',
DEFAULT_VSCODE_COMMAND, 'Visual Studio Code', True,
TextToShortCut(DEFAULT_SHORTCUT_TEXT));
Exit;
end;
if SameText(EditorId, 'cursor') then begin
Result := CreateBuiltInEditor(
'cursor', 'Cursor', 'https://cursor.com/',
'cursor', 'Cursor', False, 0);
Exit;
end;
if SameText(EditorId, 'windsurf') then begin
Result := CreateBuiltInEditor(
'windsurf', 'Windsurf', 'https://windsurf.com/editor',
'windsurf', 'Windsurf', False, 0);
Exit;
end;
if SameText(EditorId, 'trae') then begin
Result := CreateBuiltInEditor(
'trae', 'TRAE', 'https://www.trae.ai/',
'trae', 'TRAE', False, 0);
Exit;
end;
if SameText(EditorId, 'vscodium') then begin
Result := CreateBuiltInEditor(
'vscodium', 'VSCodium', 'https://vscodium.com/',
'codium', 'VSCodium', False, 0);
Exit;
end;
Result := nil;
end;
class function TPluginSettings.CreateNewCustomEditor(const DisplayName: string): TEditorSettings;
begin
var CustomId := 'custom-' + StringReplace(GuidToString(TGUID.NewGuid), '-', '', [rfReplaceAll]);
CustomId := StringReplace(CustomId, '{', '', [rfReplaceAll]);
CustomId := StringReplace(CustomId, '}', '', [rfReplaceAll]);
Result := TEditorSettings.Create(
CustomId,
DisplayName,
'',
False,
'',
0,
DEFAULT_WINDOW_CLASS_NAME,
'',
DEFAULT_REUSE_OPEN_ARGS,
DEFAULT_REUSE_GOTO_ARGS,
DEFAULT_NEW_OPEN_ARGS,
DEFAULT_NEW_GOTO_ARGS,
'');
end;
class procedure TPluginSettings.ReplaceCustomEditors(SourceEditors: TObjectList<TEditorSettings>);
begin
FCustomEditors.Clear;
if SourceEditors = nil then
Exit;
for var SourceEditor in SourceEditors do
FCustomEditors.Add(SourceEditor.Clone);
end;
class function TPluginSettings.FindBuiltInEditor(const EditorId: string): TEditorSettings;
begin
Result := nil;
for var Editor in FBuiltInEditors do
if SameText(Editor.Id, EditorId) then
begin
Result := Editor;
Exit;
end;
end;
class function TPluginSettings.GetVSCodeEditor: TEditorSettings;
begin
Result := FindBuiltInEditor('vscode');
end;
class function TPluginSettings.GetVSCodeCommand: string;
begin
var VSCodeEditor := GetVSCodeEditor;
if VSCodeEditor = nil then begin
Result := DEFAULT_VSCODE_COMMAND;
Exit;
end;
Result := VSCodeEditor.Command;
end;
class procedure TPluginSettings.SetVSCodeCommand(const Value: string);
begin
var VSCodeEditor := GetVSCodeEditor;
if VSCodeEditor = nil then
Exit;
VSCodeEditor.Enabled := True;
VSCodeEditor.Command := Value;
end;
class function TPluginSettings.GetVSCodeShortcut: TShortCut;
begin
var VSCodeEditor := GetVSCodeEditor;
if VSCodeEditor = nil then begin
Result := TextToShortCut(DEFAULT_SHORTCUT_TEXT);
Exit;
end;
Result := VSCodeEditor.Shortcut;
end;
class procedure TPluginSettings.SetVSCodeShortcut(const Value: TShortCut);
begin
var VSCodeEditor := GetVSCodeEditor;
if VSCodeEditor = nil then
Exit;
VSCodeEditor.Enabled := True;
VSCodeEditor.Shortcut := Value;
end;
class procedure TPluginSettings.LoadLegacySettings(Root: TJSONObject);
begin
var VSCodeEditor := GetVSCodeEditor;
if VSCodeEditor = nil then
Exit;
var JsonValue := Root.GetValue('vsCodeCommand');
if (JsonValue <> nil) and (Trim(JsonValue.Value) <> '') then
VSCodeEditor.Command := JsonValue.Value;
JsonValue := Root.GetValue('shortcut');
if JsonValue <> nil then
VSCodeEditor.Shortcut := ParseStoredShortcutText(JsonValue.Value, VSCodeEditor.Shortcut);
end;
class procedure TPluginSettings.LoadNewSettings(Root: TJSONObject);
begin
var BuiltInEditorsArray := Root.GetValue('builtInEditors') as TJSONArray;
if BuiltInEditorsArray <> nil then
for var BuiltInEditorValue in BuiltInEditorsArray do begin
var BuiltInEditorObject := BuiltInEditorValue as TJSONObject;
if BuiltInEditorObject = nil then
Continue;
var IdValue := BuiltInEditorObject.GetValue('id');
if IdValue = nil then
Continue;
var BuiltInEditor := FindBuiltInEditor(IdValue.Value);
if BuiltInEditor = nil then
Continue;
BuiltInEditor.LoadFromJson(BuiltInEditorObject);
end;
FCustomEditors.Clear;
var CustomEditorsArray := Root.GetValue('customEditors') as TJSONArray;
if CustomEditorsArray = nil then
Exit;
for var CustomEditorValue in CustomEditorsArray do begin
var CustomEditorObject := CustomEditorValue as TJSONObject;
if CustomEditorObject = nil then
Continue;
FCustomEditors.Add(CreateCustomEditorFromJson(CustomEditorObject));
end;
end;
class procedure TPluginSettings.Load;
var
Root: TJSONObject;
begin
ResetToDefaults;
if not TFile.Exists(SettingsFilePath) then
Exit;
try
Root := TJSONObject.ParseJSONValue(TFile.ReadAllText(SettingsFilePath, TEncoding.UTF8)) as TJSONObject;
except
Exit;
end;
if Root = nil then
Exit;
try
if Root.GetValue('builtInEditors') <> nil then begin
LoadNewSettings(Root);
Exit;
end;
if (Root.GetValue('vsCodeCommand') <> nil) or (Root.GetValue('shortcut') <> nil) then begin
LoadLegacySettings(Root);
Save;
end;
finally
Root.Free;
end;
end;
class procedure TPluginSettings.Save;
var
DirPath: string;
Root: TJSONObject;
BuiltInEditorsArray: TJSONArray;
CustomEditorsArray: TJSONArray;
begin
DirPath := ExtractFilePath(SettingsFilePath);
if not TDirectory.Exists(DirPath) then
TDirectory.CreateDirectory(DirPath);
Root := TJSONObject.Create;
try
Root.AddPair('formatVersion', TJSONNumber.Create(SETTINGS_FORMAT_VERSION));
BuiltInEditorsArray := TJSONArray.Create;
for var BuiltInEditor in FBuiltInEditors do
BuiltInEditorsArray.AddElement(BuiltInEditor.ToJson);
Root.AddPair('builtInEditors', BuiltInEditorsArray);
CustomEditorsArray := TJSONArray.Create;
for var CustomEditor in FCustomEditors do
CustomEditorsArray.AddElement(CustomEditor.ToJson);
Root.AddPair('customEditors', CustomEditorsArray);
TFile.WriteAllText(SettingsFilePath, Root.Format, TEncoding.UTF8);
finally
Root.Free;
end;
end;
class procedure TPluginSettings.NotifyShortcutChanged;
begin
if Assigned(FOnShortcutChanged) then
FOnShortcutChanged(Shortcut);
end;
class procedure TPluginSettings.NotifySettingsChanged;
begin
if Assigned(FOnSettingsChanged) then
FOnSettingsChanged;
end;
class function TPluginSettings.BuiltInEditors: TArray<TEditorSettings>;
begin
Result := FBuiltInEditors.ToArray;
end;
class function TPluginSettings.CustomEditors: TArray<TEditorSettings>;
begin
Result := FCustomEditors.ToArray;
end;
end.