fix(hub-client): stop Monaco auto-closing inline-code backticks (bd-w1s38lbe)#338
Merged
Merged
Conversation
…1s38lbe) The `qmd` Monaco language configuration listed the backtick in `autoClosingPairs`. Monaco auto-closes only when the next char is whitespace/EOL, so wrapping an existing word in inline code doubled the trailing backtick: typing `` ` `` before the word inserts one (next char is a word char → no auto-close), but typing `` ` `` after it auto-closes (next char is EOL → pair inserted), forcing a manual delete. Remove the backtick from `autoClosingPairs`. It stays in `surroundingPairs`, so typing `` ` `` over a selection still wraps it. Add a regression test (exporting `qmdLanguageConfiguration` for assertion). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…8lbe) Co-Authored-By: Claude Opus 4.8 (1M context) <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.
Problem
A quarto-hub.com user reported that wrapping an existing word in inline code is awkward in the Monaco editor:
Root cause
The
qmdMonaco language configuration (hub-client/src/components/quartoTheme.ts) listed the backtick inautoClosingPairs. Monaco only auto-closes when the next character is whitespace/EOL — never a word character — which produces the exact asymmetry reported:`|word): next char isw, so no auto-close → one backtick.`word|): next char is EOL, so Monaco auto-closes → the pair is inserted → two backticks, one of which must be deleted.Fix
Remove the backtick from
autoClosingPairs. It stays insurroundingPairs, so typing`over a selection still wraps it (Monaco treats the two lists independently). This is the minimal, targeted change — other auto-closing pairs ([,(,{,",$) are untouched.Tests
quartoTheme.test.ts(exportingqmdLanguageConfiguration): backtick must be absent fromautoClosingPairsand present insurroundingPairs. Confirmed it failed before the fix and passes after.npm run test:ci→ 18 files / 121 tests pass.npm run build:all→ clean production build.`at the end of a word now inserts a single backtick, and wrap-selection still works.Plan:
claude-notes/plans/2026-06-24-monaco-backtick-autoclose.md🤖 Generated with Claude Code