Add ggsql as a bundled language for input_code_editor#1291
Open
Add ggsql as a bundled language for input_code_editor#1291
Conversation
1 task
Add ggsql (SQL + visualization grammar) as a first-class language in prism-code-editor. The grammar extends SQL with ggsql-specific tokens: clause keywords (VISUALISE, DRAW, SCALE, etc.), geom types, aesthetic names, theme names, project types, and an extended SQL function list. Derived from the TextMate grammar at: https://github.com/posit-dev/ggsql/blob/main/ggsql-vscode/syntaxes/ggsql.tmLanguage.json Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Rscript tools/build_ggsql_grammar.R fetches the TextMate grammar from posit-dev/ggsql, extracts token patterns, and generates the Prism grammar file. The generated ggsql.js should be copied to py-shiny after regeneration. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Instead of hardcoding clause keywords, extract them from the begin captures and keyword.other patterns of all *-clause repository entries. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
d8e4bcd to
f084f5a
Compare
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
ggsqlas a first-class language in prism-code-editor, soinput_code_editor(language="ggsql")works nativelyFiles changed
inst/lib/prism-code-editor/prism/languages/ggsql.js— new Prism grammar file that importssql.jsand extends ittools/yarn_install.R— added"ggsql"tocode_editor_bundled_languagesR/versions.R— added"ggsql"to the generated allowlistTest plan
devtools::load_all(); shinyApp(page_fluid(input_code_editor("test", language = "ggsql", value = "SELECT * FROM t VISUALISE x AS x DRAW point")), function(input, output, session) {})— verify VISUALISE, DRAW, point get distinct highlighting🤖 Generated with Claude Code