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
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [0.19.0] - Unreleased

### Added:

- Command: `dev-proxy-toolkit.config-open` - Open configuration file

### Changed:

- Commands: Refactored stop command logic
- Command: Refactored stop command logic

## [0.18.3] - 2025-03-03

Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ The following sections describe the features that the extension contributes to V
- `Dev Proxy Toolkit: Raise mock request` - Only available when Dev Proxy is running
- `Dev Proxy Toolkit: Start recording` - Only available when Dev Proxy is running
- `Dev Proxy Toolkit: Stop recording`- Only available when Dev Proxy is recording
- `Dev Proxy Toolkit: Open configuration file`- Only available when Dev Proxy is installed

### Diagnostics

Expand Down
9 changes: 8 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,13 @@
"category": "Dev Proxy Toolkit",
"icon": "$(circle-slash)",
"enablement": "isDevProxyRunning && isDevProxyRecording"
},
{
"command": "dev-proxy-toolkit.config-open",
"title": "Open configuration file",
"category": "Dev Proxy Toolkit",
"icon": "$(file-code)",
"enablement": "isDevProxyInstalled"
}
],
"menus": {
Expand Down Expand Up @@ -170,4 +177,4 @@
"dependencies": {
"json-to-ast": "^2.1.0"
}
}
}
12 changes: 10 additions & 2 deletions src/commands.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as vscode from 'vscode';
import { pluginDocs } from './constants';
import { VersionPreference } from './enums';
import { VersionExeName, VersionPreference } from './enums';
import { executeCommand, isConfigFile } from './helpers';

export const registerCommands = (context: vscode.ExtensionContext, configuration: vscode.WorkspaceConfiguration) => {
Expand Down Expand Up @@ -187,4 +187,12 @@ export const registerCommands = (context: vscode.ExtensionContext, configuration
vscode.window.showErrorMessage('Failed to stop recording');
}
}));
};

context.subscriptions.push(
vscode.commands.registerCommand('dev-proxy-toolkit.config-open', async () => {
const versionPreference = configuration.get('version') as VersionPreference;
versionPreference === VersionPreference.Stable
? await executeCommand(`${VersionExeName.Stable} config open`)
: await executeCommand(`${VersionExeName.Beta} config open`);
}));
};
4 changes: 3 additions & 1 deletion src/state.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,7 @@ import { detectDevProxyInstall } from './detect';
import { VersionPreference } from './enums';

export const updateGlobalState = async (context: vscode.ExtensionContext, versionPreference: VersionPreference) => {
context.globalState.update('devProxyInstall', await detectDevProxyInstall(versionPreference));
const devProxyInstall = await detectDevProxyInstall(versionPreference);
vscode.commands.executeCommand('setContext', 'isDevProxyInstalled', devProxyInstall.isInstalled);
context.globalState.update('devProxyInstall', devProxyInstall);
};