mirror of
https://github.com/apple/pkl.git
synced 2026-01-11 14:20:35 +01:00
[PR #1385] Add syntax highlighting of Pkl code #1060
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/apple/pkl/pull/1385
Author: @bioball
Created: 12/24/2025
Status: 🔄 Open
Base:
main← Head:syntax-highlighting📝 Commits (1)
56b8607Add syntax highlighting of Pkl code📊 Changes
8 files changed (+270 additions, -22 deletions)
View changed files
📝
pkl-cli/src/main/kotlin/org/pkl/cli/CliRepl.kt(+1 -1)📝
pkl-cli/src/main/kotlin/org/pkl/cli/repl/Repl.kt(+39 -11)📝
pkl-core/src/main/java/org/pkl/core/repl/ReplServer.java(+7 -2)📝
pkl-core/src/main/java/org/pkl/core/runtime/StackTraceRenderer.java(+7 -4)📝
pkl-core/src/main/java/org/pkl/core/util/AnsiStringBuilder.java(+25 -2)📝
pkl-core/src/main/java/org/pkl/core/util/AnsiTheme.java(+12 -2)➕
pkl-core/src/main/java/org/pkl/core/util/SyntaxHighlighter.java(+171 -0)📝
pkl-parser/src/main/java/org/pkl/parser/Lexer.java(+8 -0)📄 Description
This adds syntax highlighting of Pkl code!
It adds highlighting for:
This uses the lexer for highlighting. It will highlight strings, numbers, keywords, but doesn't understand how to highlight nodes like types, function params, etc.
The reason for this is because a single line of code by itself may not be grammatically valid.
Sample screenshots:
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.