The attribute plugin is not available, 2fa disabled

Meta API

API referenca za WvdS VSCode UI Meta Extension.

Pregled

Meta Extension upravlja register komponent in zagotavlja storitve IntelliSense.

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

Register komponent

RegisterComponent

procedure RegisterComponent(const AInfo: TWvdSComponentInfo);

Registrira novo komponento v register.

type
  TWvdSComponentInfo = record
    Name: string;           // npr. 'Button'
    Description: string;    // Kratek opis
    Category: string;       // npr. 'Input', 'Layout'
    Namespace: string;      // npr. 'WvdS.UI.Controls'
    Properties: TWvdSPropertyInfoArray;
    Events: TWvdSEventInfoArray;
  end;

Primer:

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;

Vrne informacije o komponenti.

GetAllComponents

function GetAllComponents: TWvdSComponentInfoArray;

Vrne vse registrirane komponente.

GetComponentsByCategory

function GetComponentsByCategory(const ACategory: string): TWvdSComponentInfoArray;

Vrne vse komponente kategorije.

Informacije o lastnostih

TWvdSPropertyInfo

type
  TWvdSPropertyInfo = record
    Name: string;           // Ime lastnosti
    PropType: string;       // 'string', 'number', 'boolean', ...
    Description: string;    // Dokumentacija
    DefaultValue: string;   // Privzeta vrednost
    Required: Boolean;      // Obvezno polje?
    EnumValues: TStringArray; // Pri tipu Enum
  end;

GetPropertyInfo

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

Informacije o dogodkih

TWvdSEventInfo

type
  TWvdSEventInfo = record
    Name: string;           // Ime dogodka (npr. 'Click')
    Description: string;    // Dokumentacija
    HandlerSignature: string; // npr. 'procedure(Sender: TObject)'
  end;

Ponudnik IntelliSense

GetCompletions

function GetCompletions(AContext: TWvdSCompletionContext): TWvdSCompletionItemArray;

Vrne predloge za dokončanje za pozicijo.

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;

Vrne dokumentacijo ob prehodu miške za pozicijo.

type
  TWvdSHoverInfo = record
    Contents: string;       // Markdown vsebina
    Range: TRange;          // Obseg v dokumentu
  end;

Upravljanje predpomnilnika

RefreshRegistry

procedure RefreshRegistry;

Ponovno naloži register in posodobi predpomnilnik.

ClearCache

procedure ClearCache;

Izbriše predpomnilnik komponent.

GetCachePath

function GetCachePath: string;

Vrne pot do imenika predpomnilnika.

Anotacije

Komponente je mogoče registrirati prek anotacij:

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;

Glejte tudi

Zuletzt geändert: dne 29.01.2026 ob 22:25