Object Explorer API (#783)

See https://github.com/Microsoft/sqlopsstudio/wiki/Extensibility-API#object-explorer for usage details
This commit is contained in:
Matt Irvine
2018-03-09 15:02:20 -08:00
committed by GitHub
parent fab4185c1f
commit c06ab27d08
13 changed files with 707 additions and 63 deletions

61
src/sql/sqlops.d.ts vendored
View File

@@ -108,6 +108,67 @@ declare module 'sqlops' {
}
}
/**
* Namespace for interacting with Object Explorer
*/
export namespace objectexplorer {
/**
* Get an Object Explorer node corresponding to the given connection and path. If no path
* is given, it returns the top-level node for the given connection. If there is no node at
* the given path, it returns undefined.
* @param {string} connectionId The id of the connection that the node exists on
* @param {string?} nodePath The path of the node to get
* @returns {ObjectExplorerNode} The node corresponding to the given connection and path,
* or undefined if no such node exists.
*/
export function getNode(connectionId: string, nodePath?: string): Thenable<ObjectExplorerNode>;
/**
* Get all active Object Explorer connection nodes
* @returns {ObjectExplorerNode[]} The Object Explorer nodes for each saved connection
*/
export function getActiveConnectionNodes(): Thenable<ObjectExplorerNode[]>;
/**
* Interface for representing and interacting with items in Object Explorer
*/
export interface ObjectExplorerNode extends NodeInfo {
/**
* The id of the connection that the node exists under
*/
connectionId: string;
/**
* Whether the node is currently expanded in Object Explorer
*/
isExpanded(): Thenable<boolean>;
/**
* Set whether the node is expanded or collapsed
* @param expandedState The new state of the node. If 'None', the node will not be changed
*/
setExpandedState(expandedState: vscode.TreeItemCollapsibleState): Thenable<void>;
/**
* Set whether the node is selected
* @param selected Whether the node should be selected
* @param clearOtherSelections If true, clear any other selections. If false, leave any existing selections.
* Defaults to true when selected is true and false when selected is false.
*/
setSelected(selected: boolean, clearOtherSelections?: boolean): Thenable<void>;
/**
* Get all the child nodes. Returns an empty list if there are no children.
*/
getChildren(): Thenable<ObjectExplorerNode[]>;
/**
* Get the parent node. Returns undefined if there is none.
*/
getParent(): Thenable<ObjectExplorerNode>;
}
}
// EXPORTED INTERFACES /////////////////////////////////////////////////
export interface ConnectionInfo {