Inhaltsverzeichnis
Meta API
API-referenca za WvdS VSCode UI Meta Extension.
Pregled
Meta Extension upravlja registrom komponenata i pruža IntelliSense-servise.
uses WvdS.Meta.Registry, WvdS.Meta.IntelliSense;
Registar komponenata
RegisterComponent
procedure RegisterComponent(const AInfo: TWvdSComponentInfo);
Registrira novu komponentu u registru.
type TWvdSComponentInfo = record Name: string; // npr. 'Button' Description: string; // Kratki opis Category: string; // npr. 'Input', 'Layout' Namespace: string; // npr. 'WvdS.UI.Controls' Properties: TWvdSPropertyInfoArray; Events: TWvdSEventInfoArray; end;
Primjer:
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;
GetComponent
function GetComponent(const AName: string): TWvdSComponentInfo;
Vraća informacije o komponenti.
GetAllComponents
function GetAllComponents: TWvdSComponentInfoArray;
Vraća sve registrirane komponente.
GetComponentsByCategory
function GetComponentsByCategory(const ACategory: string): TWvdSComponentInfoArray;
Vraća sve komponente jedne kategorije.
Informacije o svojstvima
TWvdSPropertyInfo
type TWvdSPropertyInfo = record Name: string; // Naziv svojstva PropType: string; // 'string', 'number', 'boolean', ... Description: string; // Dokumentacija DefaultValue: string; // Zadana vrijednost Required: Boolean; // Obvezno polje? EnumValues: TStringArray; // Kod Enum-tipa end;
GetPropertyInfo
function GetPropertyInfo( const AComponentName: string; const APropertyName: string ): TWvdSPropertyInfo;
Informacije o eventima
TWvdSEventInfo
type TWvdSEventInfo = record Name: string; // Naziv eventa (npr. 'Click') Description: string; // Dokumentacija HandlerSignature: string; // npr. 'procedure(Sender: TObject)' end;
IntelliSense-Provider
GetCompletions
function GetCompletions(AContext: TWvdSCompletionContext): TWvdSCompletionItemArray;
Vraća prijedloge za dovršavanje za poziciju.
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;
GetHoverInfo
function GetHoverInfo( const ADocumentUri: string; APosition: TPosition ): TWvdSHoverInfo;
Vraća hover-dokumentaciju za poziciju.
type TWvdSHoverInfo = record Contents: string; // Markdown-sadržaj Range: TRange; // Raspon u dokumentu end;
Upravljanje cache-om
RefreshRegistry
procedure RefreshRegistry;
Ponovno učitava registar i ažurira cache.
ClearCache
procedure ClearCache;
Briše cache komponenata.
GetCachePath
function GetCachePath: string;
Vraća putanju do cache-direktorija.
Annotations
Komponente se mogu registrirati preko Annotations:
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;
Uporaba:
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;
Vidi također
Zuletzt geändert: 29.01.2026. u 22:30