API Reference for the WvdS VSCode Core Extension.
The Core Extension provides central services that can be used by all other extensions.
uses WvdS.Core.Services, WvdS.Core.Toolchain, WvdS.Core.Logging;
procedure LogInfo(const AMessage: string); procedure LogInfo(const AFormat: string; const AArgs: array of const);
Writes an info message to the Output Channel.
procedure LogWarn(const AMessage: string); procedure LogWarn(const AFormat: string; const AArgs: array of const);
Writes a warning to the Output Channel.
procedure LogError(const AMessage: string); procedure LogError(const AFormat: string; const AArgs: array of const);
Writes an error to the Output Channel.
{$IFDEF DEBUG} procedure LogDebug(const AMessage: string); procedure LogDebug(const AFormat: string; const AArgs: array of const); {$ENDIF}
Writes a debug message. Only available when compiling with -dDEBUG.
function GetToolPath(ATool: TWvdSToolType): string;
Returns the configured path for a tool.
| TWvdSToolType | Description |
|---|---|
| ttFPC | Free Pascal Compiler |
| ttPas2js | pas2js Transpiler |
| ttLazbuild | Lazarus Build Tool |
| ttInnoSetup | Inno Setup Compiler |
| ttMake | GNU Make |
Example:
var FpcPath: string; begin FpcPath := GetToolPath(ttFPC); if FpcPath = '' then raise EWvdSToolNotFound.Create(rsToolNotFound); end;
function GetToolVersion(ATool: TWvdSToolType): string;
Returns the version of an installed tool.
function IsToolAvailable(ATool: TWvdSToolType): Boolean;
Checks if a tool is available.
procedure AutoDetectTools;
Performs automatic detection of all tools.
function GetConfiguration(const ASection: string): TJSObject;
Reads VS Code configuration.
Example:
var Config: TJSObject; LogLevel: string; begin Config := GetConfiguration('wvds.core'); LogLevel := String(Config['logLevel']); end;
procedure UpdateConfiguration( const ASection: string; const AKey: string; AValue: JSValue; ATarget: TConfigurationTarget );
Writes VS Code configuration.
| TConfigurationTarget | Description |
|---|---|
| ctGlobal | User settings |
| ctWorkspace | Workspace settings |
| ctWorkspaceFolder | Folder settings |
procedure PublishEvent(const AEventName: string; AData: TJSObject);
Publishes an event for other extensions.
Example:
var Data: TJSObject; begin Data := TJSObject.New; Data['projectPath'] := ProjectPath; Data['success'] := True; PublishEvent('wvds.build.completed', Data); end;
procedure SubscribeEvent( const AEventName: string; AHandler: TWvdSEventHandler );
Subscribes to events.
Example:
procedure HandleBuildCompleted(AData: TJSObject); begin if Boolean(AData['success']) then LogInfo('Build succeeded!') else LogError('Build failed!'); end; // On activation: SubscribeEvent('wvds.build.completed', @HandleBuildCompleted);
procedure ShowInfoMessage(const AMessage: string); function ShowInfoMessage( const AMessage: string; const AItems: array of string ): TJSPromise; // Resolves to selected item
procedure ShowWarningMessage(const AMessage: string);
procedure ShowErrorMessage(const AMessage: string);
function ShowQuickPick( const AItems: array of string; const APlaceholder: string ): TJSPromise;
function GetWorkspaceRoot: string;
Returns the path to the workspace folder.
function GetOpenDocument: string;
Returns the path to the currently open document.