Skip to content

Use current compiler context to show Expr in macros #6258

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

Conversation

nicolasstucki
Copy link
Contributor

No description provided.

@nicolasstucki nicolasstucki self-assigned this Apr 8, 2019
@nicolasstucki nicolasstucki force-pushed the use-current-compiler-context-to-show-expr-in-macros branch from 6b57327 to c05247a Compare April 8, 2019 09:58
@nicolasstucki nicolasstucki marked this pull request as ready for review April 8, 2019 11:48
@nicolasstucki nicolasstucki requested a review from liufengyun April 8, 2019 11:49
Copy link
Contributor

@liufengyun liufengyun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@nicolasstucki nicolasstucki merged commit 0d0274b into scala:master Apr 8, 2019
@ghost ghost removed the stat:needs review label Apr 8, 2019
@nicolasstucki nicolasstucki deleted the use-current-compiler-context-to-show-expr-in-macros branch April 8, 2019 18:46

/** Show a source code like representation of this type */
def show(implicit ctx: Context): String =
unseal.showCode
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nicolasstucki We need to allow one option color: Boolean = false here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It should be inheriting the one from the compiler. Is that the case?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should be able to create a new setting with the setting enabled or disabled

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In macro usage, usually, there will never be a need for colors -- because the text will be used for values. Inheriting from the compiler is not the correct behavior.

The Toobox settings does not work as expected. I currently use the following walkaround:

def (str: String) clean: String = str.replaceAll("\u001B\\[[;\\d]*m", "")

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants