Skip to content

Commit

Permalink
Script async output is being shown without the debugger process outpu…
Browse files Browse the repository at this point in the history
…t and the debug example is a bit longer to illustrate the step in feature
  • Loading branch information
azawawi committed Nov 7, 2014
1 parent 6576638 commit ea5fb5f
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 10 deletions.
6 changes: 5 additions & 1 deletion debug_01.pl
Expand Up @@ -2,4 +2,8 @@

my $x = 10;

say "Hello world $($x + 1)";
say "Your number: $($x)";

say "Double your number: $($x * 2)";

say "Square your number $($x * $x)";
28 changes: 21 additions & 7 deletions lib/Farabi6/Editor.pm6
Expand Up @@ -569,13 +569,20 @@ method start-debugging-session(Str $source)
$so.act: {
my $response = $_;

my $ANSI_BLUE = / \x1B '[34m' /;
my $ANSI_RESET = / \x1B '[0m' /;
my $ANSI_BOLD_YELLOW = / \x1B '[1;33m' /;
my $ESC = "\x1B";
my $ANSI_BLUE = / $ESC '[34m' /;
my $ANSI_RESET = / $ESC '[0m' /;
my $ANSI_BOLD_YELLOW = / $ESC '[1;33m' /;
my $ANSI_MAGENTA = / $ESC '[35m' /;

my ($file, $from, $to);

if $response ~~ /^ $ANSI_BLUE
my $session = %debug_sessions{$result_session_id};

if $response ~~ /^ $ANSI_MAGENTA '>>>' \s+ 'LOADING' (.+?) $ /
{
"Loading $0".say;
} elsif $response ~~ /^ $ANSI_BLUE
'+' \s+
(.+?) #file name
\s+
Expand All @@ -591,8 +598,8 @@ method start-debugging-session(Str $source)
my ($file, $from, $to, $code) = ~$0, ~$1, ~$2, ~$3;

my $line_count = $from;
my @results = gather {
say "'$code'";
my @results = gather
{
for $code.split(/$ANSI_BLUE '|' \s+ $ANSI_RESET/) -> $line
{

Expand All @@ -609,10 +616,17 @@ method start-debugging-session(Str $source)
}
};

my $session = %debug_sessions{$result_session_id};
%$session<results> = @results;
}
elsif $response ~~ / ^ $ANSI_BLUE '>' \s+ $ANSI_RESET $ /
{
say "Found debug prompt...";
} else
{
%$session<stdout> ~= $_;
}

$_;
}

$se.act: {
Expand Down
3 changes: 1 addition & 2 deletions lib/Farabi6/files/assets/farabi.js
Expand Up @@ -927,9 +927,8 @@ start: function() {

// Make sure marked text is shown
currentEditor.refresh();

});

setTimeout(markDebugRanges, 1000);
};

Expand Down

0 comments on commit ea5fb5f

Please sign in to comment.