Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support configuration/tasks defined in workspaces #1486

Merged
merged 3 commits into from
Dec 13, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions src/debugging/DockerDebugConfigurationProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Licensed under the MIT License. See LICENSE.md in the project root for license information.
*--------------------------------------------------------------------------------------------*/

import { CancellationToken, commands, debug, DebugConfiguration, DebugConfigurationProvider, MessageItem, ProviderResult, window, WorkspaceFolder } from 'vscode';
import { CancellationToken, commands, debug, DebugConfiguration, DebugConfigurationProvider, MessageItem, ProviderResult, window, workspace, WorkspaceFolder } from 'vscode';
import { callWithTelemetryAndErrorHandling, IActionContext } from 'vscode-azureextensionui';
import { DockerOrchestration } from '../constants';
import { getAssociatedDockerRunTask } from '../tasks/TaskHelper';
Expand Down Expand Up @@ -43,7 +43,11 @@ export class DockerDebugConfigurationProvider implements DebugConfigurationProvi
'docker-launch',
async (actionContext: IActionContext) => {
if (!folder) {
throw new Error('To debug with Docker you must first open a folder or workspace in VS Code.');
folder = workspace.workspaceFolders[0];

if (!folder) {
throw new Error('To debug with Docker you must first open a folder or workspace in VS Code.');
}
}

if (debugConfiguration.type === undefined) {
Expand Down
8 changes: 6 additions & 2 deletions src/tasks/DockerPseudoterminal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Licensed under the MIT License. See LICENSE.md in the project root for license information.
*--------------------------------------------------------------------------------------------*/

import { CancellationToken, CancellationTokenSource, Event, EventEmitter, Pseudoterminal, TerminalDimensions, WorkspaceFolder } from 'vscode';
import { CancellationToken, CancellationTokenSource, Event, EventEmitter, Pseudoterminal, TaskScope, TerminalDimensions, workspace, WorkspaceFolder } from 'vscode';
import { CommandLineBuilder } from '../utils/commandLineBuilder';
import { resolveVariables } from '../utils/resolveVariables';
import { spawnAsync } from '../utils/spawnAsync';
Expand All @@ -28,8 +28,12 @@ export class DockerPseudoterminal implements Pseudoterminal {
constructor(private readonly taskProvider: DockerTaskProvider, private readonly task: DockerBuildTask | DockerRunTask) { }

public open(initialDimensions: TerminalDimensions | undefined): void {
const folder = this.task.scope === TaskScope.Workspace
? workspace.workspaceFolders[0]
: this.task.scope as WorkspaceFolder;

const executeContext: DockerTaskExecutionContext = {
folder: this.task.scope as WorkspaceFolder,
folder,
cancellationToken: this.cts.token,
terminal: this,
}
Expand Down