Meta API

API Reference for the WvdS VSCode UI Meta Extension.

Overview

The Meta Extension manages the component registry and provides IntelliSense services.

uses
  WvdS.Meta.Registry,
  WvdS.Meta.IntelliSense;

Component Registry

RegisterComponent

procedure RegisterComponent(const AInfo: TWvdSComponentInfo);

Registers a new component in the registry.

type
  TWvdSComponentInfo = record
    Name: string;           // e.g. 'Button'
    Description: string;    // Brief description
    Category: string;       // e.g. 'Input', 'Layout'
    Namespace: string;      // e.g. 'WvdS.UI.Controls'
    Properties: TWvdSPropertyInfoArray;
    Events: TWvdSEventInfoArray;
  end;

Example:

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;

Returns information about a component.

GetAllComponents

function GetAllComponents: TWvdSComponentInfoArray;

Returns all registered components.

GetComponentsByCategory

function GetComponentsByCategory(const ACategory: string): TWvdSComponentInfoArray;

Returns all components of a category.

Property Information

TWvdSPropertyInfo

type
  TWvdSPropertyInfo = record
    Name: string;           // Property name
    PropType: string;       // 'string', 'number', 'boolean', ...
    Description: string;    // Documentation
    DefaultValue: string;   // Default value
    Required: Boolean;      // Required field?
    EnumValues: TStringArray; // For enum types
  end;

GetPropertyInfo

function GetPropertyInfo(
  const AComponentName: string;
  const APropertyName: string
): TWvdSPropertyInfo;

Event Information

TWvdSEventInfo

type
  TWvdSEventInfo = record
    Name: string;           // Event name (e.g. 'Click')
    Description: string;    // Documentation
    HandlerSignature: string; // e.g. 'procedure(Sender: TObject)'
  end;

IntelliSense Provider

GetCompletions

function GetCompletions(AContext: TWvdSCompletionContext): TWvdSCompletionItemArray;

Returns completion suggestions for a position.

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;

Returns hover documentation for a position.

type
  TWvdSHoverInfo = record
    Contents: string;       // Markdown content
    Range: TRange;          // Range in document
  end;

Cache Management

RefreshRegistry

procedure RefreshRegistry;

Reloads the registry and updates the cache.

ClearCache

procedure ClearCache;

Clears the component cache.

GetCachePath

function GetCachePath: string;

Returns the path to the cache directory.

Annotations

Components can be registered via 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;

Usage:

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;

See Also

Zuletzt geändert: on 2026/01/29 at 10:26 PM