Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/disable-editor-ligatures.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@graphiql/react': patch
---

Disable Fira Code's font ligatures in the Monaco editors. Programming ligatures rewrote valid GraphQL into misleading glyphs — most notably `Int!=1` (a non-null `Int` with a default value of `1`) rendered as `Int≠1`, implying an inequality that isn't there. Characters now render literally. The Windows caret fix from #4040 is preserved.
11 changes: 8 additions & 3 deletions packages/graphiql-react/src/utility/create-editor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,14 @@ export function createEditor(
},
scrollBeyondLastLine: false, // cleans up unnecessary "padding-bottom" on each editor
fontFamily: '"Fira Code"',
// Enable font ligatures and fix incorrect caret position on Windows
// See: https://github.com/graphql/graphiql/issues/4040
fontLigatures: true,
// Disable Fira Code's ligatures without regressing the Windows caret fix.
// This is deliberately an explicit `font-feature-settings` string, not
// `false`: Monaco only takes its monospace caret-measurement fast path when
// this exactly equals its OFF constant (`"liga" off, "calt" off`), and that
// fast path mis-positions the caret with Fira Code on Windows (#4040). Any
// other string keeps ligatures off while forcing per-character width
// measurement, so the caret stays correct. See PR #4430 for the full write-up.
fontLigatures: '"liga" off, "calt" off, "clig" off',
lineNumbersMinChars: 2, // reduce line numbers width on the left size
roundedSelection: false, // prevent multiline text selection from highlighting +1 characters after beginning/end of selection
tabIndex: -1, // Do not allow tabbing into the editor, only via by pressing Enter or its container
Expand Down
4 changes: 4 additions & 0 deletions resources/custom-words.txt
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,10 @@ borggreve
bram
browserslistrc
calar
calt
chainable
changesets
clig
clsx
codebases
codegen
Expand Down Expand Up @@ -119,6 +121,7 @@ leebyron
Leko
LekoArts
lezer
liga
lightningcss
linenumber
linenumbers
Expand All @@ -137,6 +140,7 @@ middlewares
minipass
mockfs
modulemap
monospace
multipass
nauroze
newhope
Expand Down
Loading