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

Implement console.groupCollapsed #1452

Merged
merged 2 commits into from Jan 6, 2019

Conversation

3 participants
@kt3k
Copy link
Contributor

kt3k commented Jan 3, 2019

depends on #1363.

This PR implements console.groupCollapsed as discussed in #1355 and #1363.
When groupCollapsed is called, console goes to 'collapsed mode' and stop printing newlines on logging methods. When further group/groupCollapsed methods are called, console keeps the collapsed mode. When groupEnd which corresponds to the first groupCollapsed call is called, console gets out of 'collapsed mode'.


remaining tasks (all done):

  • use groupCollapsed in testing later in deno_std
  • test case of console.error with console.group

@kt3k kt3k force-pushed the kt3k:feature/console-group-collapsed branch 3 times, most recently from c9d132c to 861a7e1 Jan 3, 2019

add console.group & console.groupEnd #1363
- add console.group & console.groupEnd function
- add console.group & console.groupEnd test
- fix group when log info contains \n

@kt3k kt3k force-pushed the kt3k:feature/console-group-collapsed branch from 861a7e1 to fd3a409 Jan 3, 2019

@kt3k kt3k changed the title WIP Implement console.groupCollapsed Implement console.groupCollapsed Jan 3, 2019

feat: implement console.groupCollapsed
This implementation of groupCollapsed is intentionally different
from the spec defined by whatwg. See the conversation in #1355
and #1363.

@kt3k kt3k force-pushed the kt3k:feature/console-group-collapsed branch from fd3a409 to e798648 Jan 3, 2019

}
if (this.collapsedAt != null && this.collapsedAt >= this.indentLevel) {
this.collapsedAt = null;
this.log(); // When the collapsed state ended, outputs a sinle new line.

This comment has been minimized.

@ry

ry Jan 4, 2019

Collaborator

Why not use deno.stdout.write ?

This comment has been minimized.

@kt3k

kt3k Jan 4, 2019

Author Contributor

Because this class seems using PrintFunc for any output. Do you think we should use deno.stdout/deno.stderr for any output of console's methods?

This comment has been minimized.

@kt3k

kt3k Jan 5, 2019

Author Contributor

@ry I tried to replace printFunc calls with stdout/stderr calls, but I realized that stdout.write is async function and not usable as replacement of printFunc (libdeno.print). Probably we need to have sync version of write first. How do you think?

ref: kt3k@1e9bd29

This comment has been minimized.

@ry

ry Jan 6, 2019

Collaborator

Right - makes sense - I forgot that the writes to stdout/err are non-blocking.

@ry

ry approved these changes Jan 6, 2019

Copy link
Collaborator

ry left a comment

LGTM - thanks @kt3k !

@ry ry merged commit cae71ed into denoland:master Jan 6, 2019

2 checks passed

continuous-integration/appveyor/pr AppVeyor build succeeded
Details
license/cla Contributor License Agreement is signed.
Details

@kt3k kt3k deleted the kt3k:feature/console-group-collapsed branch Jan 7, 2019

@justjavac justjavac referenced this pull request Jan 23, 2019

Open

implement `console` follow the whatwg spec #1351

13 of 15 tasks complete
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment