-
Notifications
You must be signed in to change notification settings - Fork 39
feat: highlighting for error context #1593
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
ad3a6b2 to
0350286
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR extends syntax highlighting capabilities from the REPL to other CLI contexts, specifically adding highlighting for Kotlin compiler diagnostics/errors and guest-side language errors (JavaScript, Python, etc.).
- Enhanced terminal error display with syntax highlighting for code snippets in error messages
- Added terminal utility functions for color-mode-aware ANSI string rendering
- Extended nano syntax highlighting configuration to support the new highlighting features
Reviewed Changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/tooling/src/main/kotlin/elide/tooling/term/TerminalUtil.kt | New utility for converting AttributedString to 256-color and true-color ANSI strings |
| packages/tooling/build.gradle.kts | Added JLine dependencies for syntax highlighting support |
| packages/cli/src/main/resources/nanorc/kotlin.nanorc | Enhanced Kotlin syntax highlighting with balanced delimiters and comment definitions |
| packages/cli/src/main/resources/nanorc/jnanorc | New nano configuration file including various language syntax files |
| packages/cli/src/main/kotlin/elide/tool/cli/cmd/repl/ToolShellCommand.kt | Major refactoring of error display logic to support syntax highlighting and improved formatting |
| packages/builder/src/main/kotlin/elide/tooling/kotlin/KotlinCompiler.kt | Added terminal highlighting support for Kotlin compiler error messages |
| packages/builder/src/main/kotlin/elide/tooling/cli/Statics.kt | Added trueColor property for color mode detection |
Comments suppressed due to low confidence (2)
packages/cli/src/main/kotlin/elide/tool/cli/cmd/repl/ToolShellCommand.kt:924
- [nitpick] The function name 'highlightLineMaybe' uses informal language. Consider renaming to 'highlightLineIfPossible' or 'tryHighlightLine' for better clarity.
private fun highlightLineMaybe(line: String, langId: String?): Pair<String, Int> {
packages/builder/src/main/kotlin/elide/tooling/kotlin/KotlinCompiler.kt:160
- [nitpick] The parameter name 'codeProcessor' is vague. Consider renaming to 'syntaxHighlighter' or 'codeHighlighter' to better describe its purpose.
private val codeProcessor: (String) -> AttributedString = { AttributedString(it) },
packages/cli/src/main/kotlin/elide/tool/cli/cmd/repl/ToolShellCommand.kt
Show resolved
Hide resolved
packages/cli/src/main/kotlin/elide/tool/cli/cmd/repl/ToolShellCommand.kt
Show resolved
Hide resolved
Fixes: #1592 Signed-off-by: Sam Gammon <sam@elide.dev>
Signed-off-by: Sam Gammon <sam@elide.dev>
0350286 to
1b4717b
Compare
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #1593 +/- ##
==========================================
- Coverage 39.73% 39.68% -0.06%
==========================================
Files 780 781 +1
Lines 37118 37169 +51
Branches 5244 5253 +9
==========================================
+ Hits 14748 14749 +1
- Misses 20602 20652 +50
Partials 1768 1768
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report in Codecov by Sentry.
🚀 New features to boost your workflow:
|
Summary
Adds syntax highlighting, via our REPL tools, for code emitted in other circumstances by the CLI.
kotlincExamples