Add dialog to notebooks for managing Pip packages (#5944)

This commit is contained in:
Cory Rivera
2019-06-10 17:02:31 -07:00
committed by GitHub
parent 14a6bf581c
commit ff38bc8143
9 changed files with 613 additions and 23 deletions

View File

@@ -24,6 +24,7 @@ import { NotebookCompletionItemProvider } from '../intellisense/completionItemPr
import { JupyterNotebookProvider } from './jupyterNotebookProvider';
import { ConfigurePythonDialog } from '../dialog/configurePythonDialog';
import CodeAdapter from '../prompts/adapter';
import { ManagePackagesDialog } from '../dialog/managePackages/managePackagesDialog';
let untitledCounter = 0;
@@ -73,7 +74,7 @@ export class JupyterController implements vscode.Disposable {
});
this.apiWrapper.registerCommand(constants.jupyterReinstallDependenciesCommand, () => { return this.handleDependenciesReinstallation(); });
this.apiWrapper.registerCommand(constants.jupyterInstallPackages, () => { return this.doManagePackages(); });
this.apiWrapper.registerCommand(constants.jupyterManagePackages, () => { return this.doManagePackages(); });
this.apiWrapper.registerCommand(constants.jupyterConfigurePython, () => { return this.doConfigurePython(this._jupyterInstallation); });
let supportedFileFilter: vscode.DocumentFilter[] = [
@@ -194,10 +195,8 @@ export class JupyterController implements vscode.Disposable {
public doManagePackages(): void {
try {
let terminal = this.apiWrapper.createTerminalWithOptions({ cwd: this.getPythonBinDir() });
terminal.show(true);
let shellType = this.apiWrapper.getConfiguration().get('terminal.integrated.shell.windows');
terminal.sendText(this.getTextToSendToTerminal(shellType), true);
let packagesDialog = new ManagePackagesDialog(this._jupyterInstallation);
packagesDialog.showDialog();
} catch (error) {
let message = utils.getErrorMessage(error);
this.apiWrapper.showErrorMessage(message);
@@ -225,10 +224,6 @@ export class JupyterController implements vscode.Disposable {
}
}
private getPythonBinDir(): string {
return JupyterServerInstallation.getPythonBinPath(this.apiWrapper);
}
public get jupyterInstallation() {
return this._jupyterInstallation;
}