Skip to content

Commit

Permalink
Add application shell
Browse files Browse the repository at this point in the history
  • Loading branch information
anthonykim1 committed Feb 12, 2024
1 parent 72eb85c commit 8861db4
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,12 @@
import { inject, injectable } from 'inversify';
import * as path from 'path';
import { Disposable, Uri } from 'vscode';
import { ICommandManager, IDocumentManager, IWorkspaceService } from '../../common/application/types';
import {
IApplicationShell,
ICommandManager,
IDocumentManager,
IWorkspaceService,
} from '../../common/application/types';
import '../../common/extensions';
import { IFileSystem, IPlatformService } from '../../common/platform/types';
import { ITerminalServiceFactory } from '../../common/terminal/types';
Expand All @@ -28,6 +33,7 @@ export class DjangoShellCodeExecutionProvider extends TerminalCodeExecutionProvi
@inject(IFileSystem) fileSystem: IFileSystem,
@inject(IDisposableRegistry) disposableRegistry: Disposable[],
@inject(IInterpreterService) interpreterService: IInterpreterService,
@inject(IApplicationShell) protected readonly applicationShell: IApplicationShell,
) {
super(
terminalServiceFactory,
Expand All @@ -37,6 +43,7 @@ export class DjangoShellCodeExecutionProvider extends TerminalCodeExecutionProvi
platformService,
interpreterService,
commandManager,
applicationShell,
);
this.terminalTitle = 'Django Shell';
disposableRegistry.push(new DjangoContextInitializer(documentManager, workspace, fileSystem, commandManager));
Expand Down
4 changes: 3 additions & 1 deletion src/client/terminals/codeExecution/repl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

import { inject, injectable } from 'inversify';
import { Disposable } from 'vscode';
import { ICommandManager, IWorkspaceService } from '../../common/application/types';
import { IApplicationShell, ICommandManager, IWorkspaceService } from '../../common/application/types';
import { IPlatformService } from '../../common/platform/types';
import { ITerminalServiceFactory } from '../../common/terminal/types';
import { IConfigurationService, IDisposableRegistry } from '../../common/types';
Expand All @@ -22,6 +22,7 @@ export class ReplProvider extends TerminalCodeExecutionProvider {
@inject(IPlatformService) platformService: IPlatformService,
@inject(IInterpreterService) interpreterService: IInterpreterService,
@inject(ICommandManager) commandManager: ICommandManager,
@inject(IApplicationShell) protected readonly applicationShell: IApplicationShell,
) {
super(
terminalServiceFactory,
Expand All @@ -31,6 +32,7 @@ export class ReplProvider extends TerminalCodeExecutionProvider {
platformService,
interpreterService,
commandManager,
applicationShell,
);
this.terminalTitle = 'REPL';
}
Expand Down
12 changes: 11 additions & 1 deletion src/test/terminals/codeExecution/terminalCodeExec.unit.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,12 @@ import * as path from 'path';
import { SemVer } from 'semver';
import * as TypeMoq from 'typemoq';
import { Disposable, Uri, WorkspaceFolder } from 'vscode';
import { ICommandManager, IDocumentManager, IWorkspaceService } from '../../../client/common/application/types';
import {
IApplicationShell,
ICommandManager,
IDocumentManager,
IWorkspaceService,
} from '../../../client/common/application/types';
import { IFileSystem, IPlatformService } from '../../../client/common/platform/types';
import { createCondaEnv } from '../../../client/common/process/pythonEnvironment';
import { createPythonProcessService } from '../../../client/common/process/pythonProcess';
Expand Down Expand Up @@ -47,6 +52,7 @@ suite('Terminal - Code Execution', () => {
let pythonExecutionFactory: TypeMoq.IMock<IPythonExecutionFactory>;
let interpreterService: TypeMoq.IMock<IInterpreterService>;
let isDjangoRepl: boolean;
let applicationShell: TypeMoq.IMock<IApplicationShell>;

teardown(() => {
disposables.forEach((disposable) => {
Expand All @@ -71,6 +77,7 @@ suite('Terminal - Code Execution', () => {
fileSystem = TypeMoq.Mock.ofType<IFileSystem>();
pythonExecutionFactory = TypeMoq.Mock.ofType<IPythonExecutionFactory>();
interpreterService = TypeMoq.Mock.ofType<IInterpreterService>();
applicationShell = TypeMoq.Mock.ofType<IApplicationShell>();
settings = TypeMoq.Mock.ofType<IPythonSettings>();
settings.setup((s) => s.terminal).returns(() => terminalSettings.object);
configService.setup((c) => c.getSettings(TypeMoq.It.isAny())).returns(() => settings.object);
Expand All @@ -85,6 +92,7 @@ suite('Terminal - Code Execution', () => {
platform.object,
interpreterService.object,
commandManager.object,
applicationShell.object,
);
break;
}
Expand All @@ -97,6 +105,7 @@ suite('Terminal - Code Execution', () => {
platform.object,
interpreterService.object,
commandManager.object,
applicationShell.object,
);
expectedTerminalTitle = 'REPL';
break;
Expand All @@ -120,6 +129,7 @@ suite('Terminal - Code Execution', () => {
fileSystem.object,
disposables,
interpreterService.object,
applicationShell.object,
);
expectedTerminalTitle = 'Django Shell';
break;
Expand Down

0 comments on commit 8861db4

Please sign in to comment.