Fix embedded Ruby in markdown corrupting formatting for all .rb files
The plugin spawned a single Ruby server process whose syntax_tree plugins
were determined by whichever file triggered the first parse() call. When
a markdown file with a ```ruby fenced block was processed first, Prettier
passed the markdown parser's resolved options (e.g. trailingComma: "all")
instead of the ruby plugin's defaults (trailingComma: "none"). This caused
the trailing_comma plugin to load into the server, adding trailing commas
to every subsequent .rb file.
Replace the singleton connectionOptions with a Map keyed by the effective
plugin configuration. Each unique set of syntax_tree plugins gets its own
server process, so options from one parser context cannot leak into another.
Also fix a minor bug where reject() fell through to resolve() in the
socket end handler.
Summary by cubic
Fixes option leakage from embedded Ruby in markdown by isolating the Ruby parser server per plugin configuration. Embedded markdown can no longer cause trailing commas or other settings to affect .rb files.
-
Bug Fixes
- Spawn a server per unique plugin set using a Map keyed by resolved plugin config to prevent cross-parser option leakage.
- Generate unique temp connection files and handle missing config files; ensure errors
rejectwithout falling through toresolve.
-
Refactors
- Replace the
PRETTIER_RUBY_HOSTtest shortcut withnode:testintegration tests that runprettieras a subprocess to verify server isolation. - Update
package.jsonscripts: addtest:jestwith--forceExit, addtest:integration, and remove JestglobalTeardown.
- Replace the