Skip to content

Commit 3c729f3

Browse files
fix: prevent popup disappearing (#38)
Signed-off-by: vitaliy-guliy <[email protected]>
1 parent 1d1939f commit 3c729f3

File tree

3 files changed

+24
-16
lines changed

3 files changed

+24
-16
lines changed

.vscode/launch.json

+1-15
Original file line numberDiff line numberDiff line change
@@ -15,24 +15,10 @@
1515
"outFiles": [
1616
"${workspaceFolder}/out/**/*.js"
1717
],
18-
"preLaunchTask": "${defaultBuildTask}",
19-
18+
2019
"env": {
2120
"TEST_DEVWORKSPACE_NAME": "remote-plugin-runner"
2221
}
23-
},
24-
{
25-
"name": "Extension Tests",
26-
"type": "extensionHost",
27-
"request": "launch",
28-
"args": [
29-
"--extensionDevelopmentPath=${workspaceFolder}",
30-
"--extensionTestsPath=${workspaceFolder}/out/test/suite/index"
31-
],
32-
"outFiles": [
33-
"${workspaceFolder}/out/test/**/*.js"
34-
],
35-
"preLaunchTask": "${defaultBuildTask}"
3622
}
3723
]
3824
}

src/command/new-environment-variable.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ export class NewEnvironmentVariableImpl implements NewEnvironmentVariable {
4040
const environmentVariable = await this.defineEnvironmentVariable();
4141
if (environmentVariable) {
4242
// update Devfile, show a popup with proposal to open the Devfile
43-
await this.saveDevfile.onDidDevfileUpdate(`Environmane '${environmentVariable.name}' has been created successfully`);
43+
await this.saveDevfile.onDidDevfileUpdate(`Environment variable '${environmentVariable.name}' has been created successfully`);
4444
return true;
4545
}
4646

src/devfile-extension.ts

+22
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,28 @@ import { initBindings } from './bindings';
1717
import { InstallYaml } from './command/install-yaml';
1818

1919
export async function activate(context: vscode.ExtensionContext): Promise<void> {
20+
// Due to the bug in the upstream https://github.com/microsoft/vscode/issues/214787 it is not possible to show
21+
// several sequential popups. To prevent popup disappear it needs to add a small delay between two popups.
22+
23+
// Keep the original functions
24+
const _showQuickPick = vscode.window.showQuickPick;
25+
const _showInputBox = vscode.window.showInputBox;
26+
27+
// Replace with functions with a small delay
28+
Object.assign(vscode.window, {
29+
showQuickPick: async (items, options, token) => {
30+
const result = await _showQuickPick(items, options, token);
31+
await new Promise(resolve => setTimeout(resolve, 300));
32+
return result;
33+
},
34+
35+
showInputBox: async (options, token) => {
36+
const result = await _showInputBox(options, token);
37+
await new Promise(resolve => setTimeout(resolve, 300));
38+
return result;
39+
}
40+
});
41+
2042
const container = initBindings();
2143
container.get(DevfileExtensionImpl).start(context);
2244
}

0 commit comments

Comments
 (0)