Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce Pure IDE terminal debug command #3752

Closed
wants to merge 2 commits into from
Closed
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
5 changes: 5 additions & 0 deletions .changeset/hip-books-eat.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@finos/legend-application-pure-ide': patch
---

Introduce Pure IDE terminal debug command
Original file line number Diff line number Diff line change
Expand Up @@ -162,4 +162,5 @@ export enum LEGEND_PURE_IDE_TERMINAL_COMMAND {
CLEAR = 'clear',
ANSI = 'ansi',
HELP = 'help',
DEBUG = 'debug',
}
Original file line number Diff line number Diff line change
Expand Up @@ -343,6 +343,18 @@ export const setupTerminal = (ideStore: PureIDEStore): void => {
return Promise.resolve();
},
},
{
command: LEGEND_PURE_IDE_TERMINAL_COMMAND.DEBUG,
description:
'Introsptect debug state. When passing no parameters, will show display summary of available variables',
usage: 'debug [summary | abort | _expression_to_eval_]',
aliases: [],
handler: async (args: string[]): Promise<void> => {
flowResult(ideStore.debugging({ args })).catch(
ideStore.applicationStore.alertUnhandledError,
);
},
},
{
command: LEGEND_PURE_IDE_TERMINAL_COMMAND.HELP,
description: 'Show help',
Expand Down
19 changes: 19 additions & 0 deletions packages/legend-application-pure-ide/src/stores/PureIDEStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,7 @@ export class PureIDEStore implements CommandRegistrar {
loadFile: flow,
execute: flow,
executeGo: flow,
debugging: flow,
manageExecuteGoResult: flow,
executeTests: flow,
executeFullTestSuite: flow,
Expand Down Expand Up @@ -880,6 +881,24 @@ export class PureIDEStore implements CommandRegistrar {
);
}

*debugging(command: { args: string[] }): GeneratorFn<void> {
yield flowResult(
this.client
.execute([], 'debugging', command)
.then((r) => {
const execResult = deserializeExecutionResult(
guaranteeNonNullable(r),
);
this.applicationStore.terminalService.terminal.output(
execResult.text!,
);
})
.catch((er) => {
this.applicationStore.terminalService.terminal.fail(er.message);
}),
);
}

*manageExecuteGoResult(
result: ExecutionResult,
potentiallyAffectedFiles: string[],
Expand Down
Loading