Skip to content

Commit daadbe7

Browse files
dkwon17fbricon
authored andcommitted
Fix terminal not appearing when adding extensions
Signed-off-by: David Kwon <[email protected]>
1 parent 185dc36 commit daadbe7

File tree

3 files changed

+17
-13
lines changed

3 files changed

+17
-13
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
### Bug fixes
1212

13+
* Fix terminal not appearing when adding extensions with the Add Extensions command. See [#252](https://github.com/redhat-developer/vscode-quarkus/pull/252)
1314
* `quarkus.banner.enabled` marked as error. See [#249](https://github.com/redhat-developer/vscode-quarkus/issues/249)
1415
* Completion in non-Quarkus and non-MicroProfile project causes errors. See [#247](https://github.com/redhat-developer/vscode-quarkus/issues/247)
1516

src/extension.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import * as requirements from './languageServer/requirements';
1717

1818
import { VSCodeCommands, MicroProfileLS } from './definitions/constants';
1919
import { DidChangeConfigurationNotification, LanguageClientOptions, LanguageClient } from 'vscode-languageclient';
20-
import { ExtensionContext, commands, window, workspace } from 'vscode';
20+
import { ExtensionContext, commands, window, workspace, Terminal } from 'vscode';
2121
import { QuarkusContext } from './QuarkusContext';
2222
import { addExtensionsWizard } from './wizards/addExtensions/addExtensionsWizard';
2323
import { createTerminateDebugListener } from './wizards/debugging/terminateProcess';
@@ -29,6 +29,7 @@ import { WelcomeWebview } from './webviews/WelcomeWebview';
2929
import { QuarkusConfig } from './QuarkusConfig';
3030
import { registerConfigurationUpdateCommand, registerOpenURICommand, CommandKind } from './lsp-commands';
3131
import { registerYamlSchemaSupport, MicroProfilePropertiesChangeEvent } from './yaml/YamlSchema';
32+
import { terminalCommandRunner } from './terminal/terminalCommandRunner';
3233

3334
let languageClient: LanguageClient;
3435

@@ -39,6 +40,12 @@ export function activate(context: ExtensionContext) {
3940

4041
context.subscriptions.push(createTerminateDebugListener());
4142
context.subscriptions.push(quarkusProjectListener.getQuarkusProjectListener());
43+
context.subscriptions.push(terminalCommandRunner);
44+
context.subscriptions.push(
45+
window.onDidCloseTerminal((closedTerminal: Terminal) => {
46+
terminalCommandRunner.dispose(closedTerminal.name);
47+
})
48+
);
4249

4350
/**
4451
* Register Yaml Schema support to manage application.yaml

src/terminal/terminalCommandRunner.ts

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -44,19 +44,15 @@ class TerminalCommandRunner implements Disposable {
4444
});
4545
}
4646

47-
public onDidCloseTerminal(closedTerminal: Terminal): void {
48-
try {
49-
delete this.terminals[closedTerminal.name];
50-
} catch (error) {
51-
// ignore it.
52-
}
53-
}
54-
55-
public dispose(id?: string): void {
56-
if (id) {
57-
this.terminals[id].dispose();
47+
public dispose(terminalName?: string): void {
48+
if (terminalName && this.terminals[terminalName] !== undefined) {
49+
this.terminals[terminalName].dispose();
50+
delete this.terminals[terminalName];
5851
} else {
59-
this.closeAllTerminals();
52+
Object.keys(this.terminals).forEach((id: string) => {
53+
this.terminals[id].dispose();
54+
delete this.terminals[id];
55+
});
6056
}
6157
}
6258
}

0 commit comments

Comments
 (0)