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

feat(cli/repl): add regex based syntax highlighter #7811

Conversation

caspervonb
Copy link
Contributor

@caspervonb caspervonb commented Oct 3, 2020

This adds a simple regex replace based highlighter to the repl editor.
Overall it tries to match the color palette of Deno.inspect.

Closes #1928

This adds a simple regex replace based highlighter to the repl editor.
@caspervonb caspervonb marked this pull request as draft October 3, 2020 13:12
@caspervonb
Copy link
Contributor Author

Example:

Screenshot 2020-10-03 at 8 51 22 PM

cli/repl.rs Outdated Show resolved Hide resolved
@caspervonb caspervonb marked this pull request as ready for review October 3, 2020 23:13
Copy link
Member

@bartlomieju bartlomieju left a comment

Choose a reason for hiding this comment

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

Looks great @caspervonb, slating for 1.5.0

@bartlomieju bartlomieju added this to the 1.5.0 milestone Oct 4, 2020
Copy link
Member

@bartlomieju bartlomieju left a comment

Choose a reason for hiding this comment

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

LGTM, thank you @caspervonb for this feature, it's extremely useful. I also like how simple the implementation is.

I'd be great to have a way to test that, but it's the same problem as with all integration tests.

(?P<boolean>\b(?:true|false)\b) |
(?P<null>\b(?:null)\b) |
(?P<undefined>\b(?:undefined)\b) |
(?P<keyword>\b(?:await|async|var|let|for|if|else|in|of|class|const|function|yield|return|with|case|break|switch|import|export|new|while|do|throw|catch)\b) |
Copy link
Contributor

Choose a reason for hiding this comment

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

missing this

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Indeed, treating it as identifier (no color) for now.

@bartlomieju bartlomieju merged commit bbf7b2e into denoland:master Oct 13, 2020
@caspervonb caspervonb deleted the feat-cli-repl-add-regex-syntax-highlighting branch October 13, 2020 17:39
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.

FR: Syntax highlighting in REPL
4 participants