Skip to content
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
3 changes: 3 additions & 0 deletions Aspire.slnx
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,9 @@
<Project Path="playground/pipelines/Pipelines.AppHost/Pipelines.AppHost.csproj" />
<Project Path="playground/pipelines/Pipelines.Library/Pipelines.Library.csproj" />
</Folder>
<Folder Name="/playground/SimplePipelines/">
<Project Path="playground/SimplePipelines/SimplePipelines.AppHost/SimplePipelines.AppHost.csproj" />
</Folder>
<Folder Name="/playground/PostgresEndToEnd/">
<Project Path="playground/PostgresEndToEnd/PostgresEndToEnd.ApiService/PostgresEndToEnd.ApiService.csproj" />
<Project Path="playground/PostgresEndToEnd/PostgresEndToEnd.AppHost/PostgresEndToEnd.AppHost.csproj" />
Expand Down
26 changes: 26 additions & 0 deletions extension/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ The extension adds the following commands to VS Code:
| Aspire: Update integrations | Update hosting integrations and Aspire SDK in the apphost. |
| Aspire: Publish deployment artifacts | Generate deployment artifacts for an Aspire apphost. |
| Aspire: Deploy app | Deploy the contents of an Aspire apphost to its defined deployment targets. |
| Aspire: Execute pipeline step (aspire do) | Execute a specific pipeline step and its dependencies. |
| Aspire: Configure launch.json file | Add the default Aspire debugger launch configuration to your workspace's `launch.json`. |
| Aspire: Extension settings | Open Aspire extension settings. |
| Aspire: Open local Aspire settings | Open the local `.aspire/settings.json` file for the current workspace. |
Expand Down Expand Up @@ -43,6 +44,31 @@ To run and debug your Aspire application, add an entry to the workspace `launch.
}
```

You can also use the `command` property to run deploy, publish, or pipeline step commands with the debugger attached:

```json
{
"type": "aspire",
"request": "launch",
"name": "Aspire: Deploy MyAppHost",
"program": "${workspaceFolder}/MyAppHost/MyAppHost.csproj",
"command": "deploy"
}
```

Supported values for `command` are `run` (default), `deploy`, `publish`, and `do`. When using `do`, you can optionally set the `step` property to specify the pipeline step to execute:

```json
{
"type": "aspire",
"request": "launch",
"name": "Aspire: Run pipeline step",
"program": "${workspaceFolder}/MyAppHost/MyAppHost.csproj",
"command": "do",
"step": "my-custom-step"
}
```

## Requirements

### Aspire CLI
Expand Down
97 changes: 93 additions & 4 deletions extension/loc/xlf/aspire-vscode.xlf

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 16 additions & 0 deletions extension/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,16 @@
"type": "object",
"description": "%extension.debug.debuggers%",
"default": {}
},
"command": {
"type": "string",
"description": "%extension.debug.command%",
"enum": ["run", "deploy", "publish", "do"],
"default": "run"
},
"step": {
"type": "string",
"description": "%extension.debug.step%"
}
}
}
Expand Down Expand Up @@ -156,6 +166,12 @@
"title": "%command.deploy%",
"category": "Aspire"
},
{
"command": "aspire-vscode.do",
"enablement": "workspaceFolderCount > 0",
"title": "%command.do%",
"category": "Aspire"
},
{
"command": "aspire-vscode.configureLaunchJson",
"enablement": "workspaceFolderCount > 0",
Expand Down
4 changes: 4 additions & 0 deletions extension/package.nls.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
"extension.description": "Official Aspire extension for Visual Studio Code",
"extension.debug.program": "Path to the apphost to run",
"extension.debug.debuggers": "Configuration to apply when launching resources of specific types",
"extension.debug.command": "The Aspire CLI command to execute (run, deploy, publish, or do)",
"extension.debug.step": "The pipeline step name to execute when command is 'do'",
"extension.debug.defaultConfiguration.name": "Aspire: Launch default apphost",
"extension.debug.defaultConfiguration.description": "Launch the effective Aspire apphost in your workspace",
"command.add": "Add an integration",
Expand All @@ -13,6 +15,7 @@
"command.updateSelf": "Update Aspire CLI",
"command.openTerminal": "Open Aspire terminal",
"command.deploy": "Deploy app",
"command.do": "Execute pipeline step (aspire do)",
"command.configureLaunchJson": "Configure launch.json file",
"command.settings": "Extension settings",
"command.openLocalSettings": "Open local Aspire settings",
Expand Down Expand Up @@ -105,6 +108,7 @@
"aspire-vscode.strings.dismissLabel": "Dismiss",
"aspire-vscode.strings.selectDirectoryTitle": "Select directory",
"aspire-vscode.strings.selectFileTitle": "Select file",
"aspire-vscode.strings.enterPipelineStep": "Enter the pipeline step to execute",
"aspire-vscode.strings.statusBarStopped": "Aspire: Stopped",
"aspire-vscode.strings.statusBarError": "Aspire: Error",
"aspire-vscode.strings.statusBarRunning": "Aspire: {0}/{1} running",
Expand Down
7 changes: 2 additions & 5 deletions extension/src/commands/deploy.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
import { AspireEditorCommandProvider } from '../editor/AspireEditorCommandProvider';
import { AspireTerminalProvider } from '../utils/AspireTerminalProvider';
import { getAppHostArgs } from '../utils/appHostArgs';

export async function deployCommand(terminalProvider: AspireTerminalProvider, editorCommandProvider: AspireEditorCommandProvider) {
const appHostArgs = await getAppHostArgs(editorCommandProvider);
await terminalProvider.sendAspireCommandToAspireTerminal('deploy', true, appHostArgs);
export async function deployCommand(editorCommandProvider: AspireEditorCommandProvider) {
await editorCommandProvider.tryExecuteDeployAppHost(false);
}
34 changes: 34 additions & 0 deletions extension/src/commands/do.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import * as vscode from 'vscode';
import { AspireEditorCommandProvider } from '../editor/AspireEditorCommandProvider';
import { AspireTerminalProvider } from '../utils/AspireTerminalProvider';
import { getConfigInfo } from '../utils/configInfoProvider';
import { enterPipelineStep } from '../loc/strings';

export async function doCommand(terminalProvider: AspireTerminalProvider, editorCommandProvider: AspireEditorCommandProvider) {
const step = await resolveStep(terminalProvider);
if (step === undefined) {
return;
}
await editorCommandProvider.tryExecuteDoAppHost(false, step ?? undefined);
}

/**
* Checks CLI capabilities to determine whether the CLI supports interactive pipeline prompting.
* Returns null if the CLI will handle prompting (new CLI with pipelines capability).
* Returns the user-provided step name if the CLI doesn't support interactive prompting (old CLI).
* Returns undefined if the user cancels.
*/
async function resolveStep(terminalProvider: AspireTerminalProvider): Promise<string | null | undefined> {
const configInfo = await getConfigInfo(terminalProvider);
if (configInfo?.Capabilities?.includes('pipelines')) {
// New CLI: it will prompt for the step via interaction service
return null;
}

// Old CLI or capabilities unavailable: prompt the user for a step
const step = await vscode.window.showInputBox({
prompt: enterPipelineStep,
placeHolder: 'deploy',
});
return step;
}
7 changes: 2 additions & 5 deletions extension/src/commands/publish.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
import { AspireEditorCommandProvider } from '../editor/AspireEditorCommandProvider';
import { AspireTerminalProvider } from '../utils/AspireTerminalProvider';
import { getAppHostArgs } from '../utils/appHostArgs';

export async function publishCommand(terminalProvider: AspireTerminalProvider, editorCommandProvider: AspireEditorCommandProvider) {
const appHostArgs = await getAppHostArgs(editorCommandProvider);
await terminalProvider.sendAspireCommandToAspireTerminal('publish', true, appHostArgs);
export async function publishCommand(editorCommandProvider: AspireEditorCommandProvider) {
await editorCommandProvider.tryExecutePublishAppHost(false);
}
Loading
Loading