Mssql extension exposes OE getNode API for Sql-2019vNext extension (#3901)

* Mssql extension exposes OE getNode API for Sql-2019Vnext extension

* Resolved PR comments
This commit is contained in:
Yurong He
2019-02-04 19:55:32 -08:00
committed by GitHub
parent ef8afab7e8
commit 80c1c4c6c8
2 changed files with 79 additions and 1 deletions

View File

@@ -24,12 +24,13 @@ import { MssqlObjectExplorerNodeProvider } from './objectExplorerNodeProvider/ob
import { UploadFilesCommand, MkDirCommand, SaveFileCommand, PreviewFileCommand, CopyPathCommand, DeleteFilesCommand } from './objectExplorerNodeProvider/hdfsCommands';
import { IPrompter } from './prompts/question';
import CodeAdapter from './prompts/adapter';
import { MssqlExtensionApi, MssqlObjectExplorerBrowser } from './api/mssqlapis';
const baseConfig = require('./config.json');
const outputChannel = vscode.window.createOutputChannel(Constants.serviceName);
const statusView = vscode.window.createStatusBarItem(vscode.StatusBarAlignment.Left);
export async function activate(context: vscode.ExtensionContext) {
export async function activate(context: vscode.ExtensionContext): Promise<MssqlExtensionApi> {
// lets make sure we support this platform first
let supported = await Utils.verifyPlatform();
@@ -113,6 +114,18 @@ export async function activate(context: vscode.ExtensionContext) {
context.subscriptions.push(new CopyPathCommand(appContext));
context.subscriptions.push(new DeleteFilesCommand(prompter, appContext));
context.subscriptions.push({ dispose: () => languageClient.stop() });
let api: MssqlExtensionApi = {
getMssqlObjectExplorerBrowser(): MssqlObjectExplorerBrowser {
return {
getNode: (context: sqlops.ObjectExplorerContext) => {
let oeProvider = appContext.getService<MssqlObjectExplorerNodeProvider>(Constants.ObjectExplorerService);
return <any>oeProvider.findNodeForContext(context);
}
};
}
};
return api;
}
function generateServerOptions(executablePath: string): ServerOptions {