VscodeBridge class

High-level bridge to a VS Code extension host.

Wraps BridgeProtocol with typed methods for all VS Code interactions: editor, diagnostics, UI, terminals, commands, and events.

Constructors

VscodeBridge({BridgeProtocol? protocol})

Properties

currentTheme → VscodeTheme?
no setter
hashCode → int
The hash code for this object.
no setterinherited
isConnected → bool
no setter
onDidChangeActiveEditor → Stream<String>
Fires when the active editor changes. Emits the document URI.
no setter
onDidChangeConfiguration → Stream<Map<String, dynamic>>
Fires when workspace configuration changes.
no setter
onDidChangeDiagnostics → Stream<List<VscodeDiagnostic>>
Fires when diagnostics change.
no setter
onDidChangeTheme → Stream<VscodeTheme>
Fires when the color theme changes.
no setter
onDidSaveDocument → Stream<String>
Fires when a document is saved. Emits the document URI.
no setter
protocol → BridgeProtocol
no setter
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
workspacePath → String?
no setter

Methods

applyWorkspaceEdit(Map<String, dynamic> edit, {String? label}) → Future<BridgeResponse>
Apply a workspace edit (multi-file).
clearDiagnostics(String uri) → void
Clear all diagnostics for a URI.
closeFile(String uri) → Future<BridgeResponse>
Close a file tab.
closeTerminal(String terminalId) → Future<BridgeResponse>
Close a terminal.
connect(String workspacePath) → Future<void>
Connect to VS Code extension host for the given workspace.
createTerminal({String? name, String? shellPath, List<String>? shellArgs, String? cwd, Map<String, String>? env}) → Future<String?>
Create a new terminal.
disconnect() → Future<void>
Disconnect from VS Code.
dispose() → void
Dispose all resources.
getActiveFile() → Future<String?>
Get the active editor file URI.
getDiagnostics(String uri) → Future<List<VscodeDiagnostic>>
Get all diagnostics for a URI.
getOpenFiles() → Future<List<String>>
Get all currently open file URIs.
getSelection() → Future<VscodeSelection?>
Get the current selection in the active editor.
insertText(String text) → Future<BridgeResponse>
Insert text at the current cursor position.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
openFile(String uri, {int? line, int? character, bool? preview}) → Future<BridgeResponse>
Open a file in the editor.
publishDiagnostics(String uri, List<VscodeDiagnostic> diagnostics) → void
Publish diagnostics for a URI.
registerCommand(VscodeCommand command) → void
Register a command that the IDE can invoke.
removeStatusBarItem(String id) → void
Remove a status bar item.
replaceRange(VscodeRange range, String newText) → Future<BridgeResponse>
Replace a range in the active editor.
sendTerminalText(String terminalId, String text, {bool addNewLine = true}) → Future<BridgeResponse>
Send text to a terminal.
setSelection(VscodeSelection selection) → Future<BridgeResponse>
Set the selection in the active editor.
showErrorMessage(String message, {List<String>? actions}) → Future<String?>
Show an error message.
showInfoMessage(String message, {List<String>? actions}) → Future<String?>
Show an information message.
showInputBox({String? prompt, String? placeholder, String? value, bool password = false}) → Future<String?>
Show an input box and return user input.
showProgress({required String title, String? message, int? percentage, bool cancellable = false}) → Future<BridgeResponse>
Show a progress notification.
showQuickPick(List<VscodeQuickPickItem> items, {String? placeholder, bool canPickMany = false}) → Future<List<VscodeQuickPickItem>?>
Show a quick pick menu and return selected items.
showWarningMessage(String message, {List<String>? actions}) → Future<String?>
Show a warning message.
toString() → String
A string representation of this object.
inherited
unregisterCommand(String commandId) → void
Unregister a command.
updateStatusBarItem(VscodeStatusBarItem item) → void
Update a status bar item.

Operators

operator ==(Object other) → bool
The equality operator.
inherited