Skip to content

Commit

Permalink
Automatically create 'launch.json'
Browse files Browse the repository at this point in the history
Automatically creates the `launch.json` file when executing
the command `start debugging` whenever a `launch.json` does not
exist under `.theia` or `.vscode`. Once created, users are prompted
to select the type of debug configuration they desire.

Signed-off-by: Vincent Fugnitto <vincent.fugnitto@ericsson.com>
  • Loading branch information
vince-fugnitto committed Nov 5, 2019
1 parent 05f2e07 commit 3998390
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -947,6 +947,11 @@ export class DebugFrontendApplicationContribution extends AbstractViewContributi

async start(noDebug?: boolean): Promise<void> {
let { current } = this.configurations;
// If no current configurations are present, create the `launch.json` and prompt users to select the config.
if (!current) {
await this.configurations.addConfiguration();
return;
}
if (current) {
if (noDebug !== undefined) {
current = {
Expand Down
11 changes: 6 additions & 5 deletions packages/debug/src/browser/view/debug-configuration-widget.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,15 @@ import { DebugSessionManager } from '../debug-session-manager';
import { DebugAction } from './debug-action';
import { DebugViewModel } from './debug-view-model';
import { DebugSessionOptions } from '../debug-session-options';
import { DebugCommands } from '../debug-frontend-application-contribution';
import { CommandRegistry } from '@theia/core/lib/common';

@injectable()
export class DebugConfigurationWidget extends ReactWidget {

@inject(CommandRegistry)
protected readonly commandRegistry: CommandRegistry;

@inject(DebugViewModel)
protected readonly viewModel: DebugViewModel;

Expand Down Expand Up @@ -118,11 +123,7 @@ export class DebugConfigurationWidget extends ReactWidget {

protected readonly start = () => {
const configuration = this.manager.current;
if (configuration) {
this.sessionManager.start(configuration);
} else {
this.manager.addConfiguration();
}
this.commandRegistry.executeCommand(DebugCommands.START.id, configuration);
}

protected readonly openConfiguration = () => this.manager.openConfiguration();
Expand Down

0 comments on commit 3998390

Please sign in to comment.