API-Referenz für die WvdS VSCode UI Meta Extension.
Die Meta Extension verwaltet die Komponenten-Registry und stellt IntelliSense-Dienste bereit.
uses WvdS.Meta.Registry, WvdS.Meta.IntelliSense;
procedure RegisterComponent(const AInfo: TWvdSComponentInfo);
Registriert eine neue Komponente in der Registry.
type TWvdSComponentInfo = record Name: string; // z.B. 'Button' Description: string; // Kurzbeschreibung Category: string; // z.B. 'Input', 'Layout' Namespace: string; // z.B. 'WvdS.UI.Controls' Properties: TWvdSPropertyInfoArray; Events: TWvdSEventInfoArray; end;
Beispiel:
var Info: TWvdSComponentInfo; begin Info.Name := 'MyButton'; Info.Description := 'Custom button with icon'; Info.Category := 'Input'; Info.Namespace := 'MyApp.Controls'; SetLength(Info.Properties, 2); Info.Properties[0].Name := 'Content'; Info.Properties[0].PropType := 'string'; Info.Properties[0].DefaultValue := ''; Info.Properties[1].Name := 'IconPath'; Info.Properties[1].PropType := 'string'; Info.Properties[1].DefaultValue := ''; RegisterComponent(Info); end;
function GetComponent(const AName: string): TWvdSComponentInfo;
Gibt Informationen zu einer Komponente zurück.
function GetAllComponents: TWvdSComponentInfoArray;
Gibt alle registrierten Komponenten zurück.
function GetComponentsByCategory(const ACategory: string): TWvdSComponentInfoArray;
Gibt alle Komponenten einer Kategorie zurück.
type TWvdSPropertyInfo = record Name: string; // Property-Name PropType: string; // 'string', 'number', 'boolean', ... Description: string; // Dokumentation DefaultValue: string; // Standardwert Required: Boolean; // Pflichtfeld? EnumValues: TStringArray; // Bei Enum-Typ end;
function GetPropertyInfo( const AComponentName: string; const APropertyName: string ): TWvdSPropertyInfo;
type TWvdSEventInfo = record Name: string; // Event-Name (z.B. 'Click') Description: string; // Dokumentation HandlerSignature: string; // z.B. 'procedure(Sender: TObject)' end;
function GetCompletions(AContext: TWvdSCompletionContext): TWvdSCompletionItemArray;
Gibt Vervollständigungsvorschläge für eine Position zurück.
type TWvdSCompletionContext = record DocumentUri: string; Position: TPosition; TriggerCharacter: Char; CurrentElement: string; CurrentAttribute: string; end; TWvdSCompletionItem = record Label: string; Kind: TWvdSCompletionKind; Detail: string; Documentation: string; InsertText: string; end;
function GetHoverInfo( const ADocumentUri: string; APosition: TPosition ): TWvdSHoverInfo;
Gibt Hover-Dokumentation für eine Position zurück.
type TWvdSHoverInfo = record Contents: string; // Markdown-Inhalt Range: TRange; // Bereich im Dokument end;
procedure RefreshRegistry;
Lädt die Registry neu und aktualisiert den Cache.
procedure ClearCache;
Löscht den Komponenten-Cache.
function GetCachePath: string;
Gibt den Pfad zum Cache-Verzeichnis zurück.
Komponenten können via Annotations registriert werden:
type ComponentInfoAttribute = class(TCustomAttribute) FName: string; FDescription: string; FCategory: string; public constructor Create(const AName, ADescription, ACategory: string); end; PropertyInfoAttribute = class(TCustomAttribute) FDescription: string; FDefaultValue: string; public constructor Create(const ADescription: string; const ADefault: string = ''); end;
Verwendung:
type {$M+} [ComponentInfo('MyButton', 'Button with icon', 'Input')] TMyButton = class(TWvdSButton) published [PropertyInfo('Path to icon image', '')] property IconPath: string read FIconPath write SetIconPath; [PropertyInfo('Button text', 'Click')] property Content: string read FContent write SetContent; end;