Commit 2cf551f6 authored by Ivan Mazhukin's avatar Ivan Mazhukin

confirm local epm play actions

parent b3745b1b
...@@ -43,7 +43,7 @@ The same VSIX can be installed from the VS Code command `Extensions: Install fro ...@@ -43,7 +43,7 @@ The same VSIX can be installed from the VS Code command `Extensions: Install fro
- `Rerun last command`: repeats the last generated command. - `Rerun last command`: repeats the last generated command.
- `Open log folder`: opens `${XDG_STATE_HOME:-$HOME/.local/state}/epm-docker-test` or the configured log root. - `Open log folder`: opens `${XDG_STATE_HOME:-$HOME/.local/state}/epm-docker-test` or the configured log root.
For local `epm play` commands, the app name is inferred from the active editor when the file is in `play.d`, `pack.d`, or `repack.d`. The extension first checks simple shell variables such as `PRODUCT=rstudio` or `PKGNAME=rstudio`, then falls back to the file name without extension. For local `epm play` commands, the app name is inferred from the active editor when the file is in `play.d`, `pack.d`, or `repack.d`. The extension first checks simple shell variables such as `PRODUCT=rstudio` or `PKGNAME=rstudio`, then falls back to the file name without extension. Before running, it asks for confirmation with the inferred app, source file, and exact command.
## Favorites ## Favorites
......
...@@ -240,7 +240,6 @@ async function runLocalPlay(latest) { ...@@ -240,7 +240,6 @@ async function runLocalPlay(latest) {
return; return;
} }
await setWorkspaceState('lastLocalApp', app);
const args = ['play']; const args = ['play'];
if (latest) { if (latest) {
args.push('--latest'); args.push('--latest');
...@@ -255,11 +254,27 @@ async function runLocalPlay(latest) { ...@@ -255,11 +254,27 @@ async function runLocalPlay(latest) {
...args.map(shellQuote) ...args.map(shellQuote)
].join(' '); ].join(' ');
const confirmed = await confirmLocalPlay(app, inferred, command);
if (!confirmed) {
return;
}
await setWorkspaceState('lastLocalApp', app);
lastRun = command; lastRun = command;
await setWorkspaceState('lastCommand', command); await setWorkspaceState('lastCommand', command);
sendToTerminal(command); sendToTerminal(command);
} }
async function confirmLocalPlay(app, inferred, command) {
const sourceText = inferred ? `\nSource: ${inferred.source}` : '';
const answer = await vscode.window.showWarningMessage(
`Собираемся проверить приложение: ${app}${sourceText}\n\n${command}\n\nСогласны?`,
{ modal: true },
'Запустить'
);
return answer === 'Запустить';
}
async function rerunLast() { async function rerunLast() {
const command = getWorkspaceState('lastCommand', lastRun); const command = getWorkspaceState('lastCommand', lastRun);
if (!command) { if (!command) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment