The HBuilderX API root object can be introduced through require(‘hbuilderx’).

  1. const hx = require('hbuilderx')

This page lists all available HBuilderX APIs.

API Details
commands a command is a function with a unique identifier. Details
hx.languages.createDiagnosticCollection() Create a diagnostics collection that can be used to display wavy lines in the error area of ​the document to identify the details of the problem during document verification. Details

api:windows

API Description
hx.window.showErrorMessage() Show an error message in the lower right corner of the window. Details
hx.window.showInformationMessage() Show an information message in the lower right corner of the window. Details
hx.window.showWarningMessage() Show a warning message in the lower right corner of the window. Details
hx.window.showMessageBox() Show a dialog box for selection in the window. Details
hx.window.setStatusBarMessage() Set status bar message. Details
hx.window.clearStatusBarMessage() Clear status bar message. Details
hx.window.showQuickPick() Display a list of searchable options that pops up in the middle of the window. Details
hx.window.getActiveTextEditor() Get the currently active editor. Details
hx.window.showInputBox() Open an input box to request user input. Details
hx.window.createOutputChannel() Creates an output channel which can be used to output text content on the console. Details
hx.window.createTreeView() Create a TreeView for the view contributed using the extension point views. Details
hx.window.createWebView() Create and show a webview panel. Details
hx.window.createWebViewDialog() Create dialog based on WebView page. Details
hx.window.showView() Switch the WebViews by the specified viewId. Details
hx.window.registerUriHandler() Register a custom network request handler that relies on the hbuilderx protoco. Details
hx.window.registerCustomEditorProvider() Register a custom editor. Details

api:workspace

API Description
hx.workspace.applyEdit() Edit the document according to the specified WorkspaceEdit object. Details
hx.workspace.copyFileWithPrompt() Copy the specified file or folder to the target folder. Details
hx.workspace.getConfiguration() Get a workspace configuration object. Details
hx.workspace.getWorkspaceFolders() Get all project objects under the project explorer (without closed projects). Details
hx.workspace.getWorkspaceFolder() Get the project where a file is located. Details
hx.workspace.openTextDocument() Open a document file through the specified uri. Details
hx.workspace.onDidChangeConfiguration() An event that is emitted when the configuration changed. Details
hx.workspace.onDidChangeWorkspaceFolders() An event that is emitted when a workspace folder is added or removed. Details
hx.workspace.onDidChangeTextDocument() An event that is emitted when a text document is changed. Details
hx.workspace.onDidSaveTextDocument() An event that is emitted when a text document is saved to disk. Details
hx.workspace.onDidOpenTextDocument() An event that is emitted when a text document is opened. Details
hx.workspace.onWillSaveTextDocument() An event that is emitted when a text document will be saved to disk. Details

api:env

API Description
env Details
hx.authorize.login() Details
hx.env.clipboard Read or write content to the System clipboard. Details
hx.env.openExternal() Open an external link. Details