File tree Expand file tree Collapse file tree 1 file changed +7
-4
lines changed
Expand file tree Collapse file tree 1 file changed +7
-4
lines changed Original file line number Diff line number Diff line change @@ -5,6 +5,7 @@ import os from "os";
55import path from "path" ;
66import process from "process" ;
77import url from "url" ;
8+ import { resolveConfigFile } from "prettier" ;
89
910// In order to properly parse ruby code, we need to tell the ruby process to
1011// parse using UTF-8. Unfortunately, the way that you accomplish this looks
@@ -67,14 +68,16 @@ export async function spawnServer(opts, killOnExit = true) {
6768 const tmpdir = os . tmpdir ( ) ;
6869 const filepath = path . join ( tmpdir , `prettier-ruby-parser-${ process . pid } .txt` ) ;
6970
70- const default_options = {
71+ const options = {
7172 env : Object . assign ( { } , process . env , { LANG : getLang ( ) } ) ,
7273 stdio : [ "ignore" , "ignore" , "inherit" ] ,
7374 detached : true
7475 } ;
75- const options = opts . filepath
76- ? { cwd : path . dirname ( opts . filepath ) , ...default_options }
77- : default_options ;
76+
77+ if ( opts . filepath ) {
78+ const prettierConfig = await resolveConfigFile ( opts . filepath ) ;
79+ options . cwd = path . dirname ( prettierConfig ) ;
80+ }
7881
7982 const server = spawn (
8083 opts . rubyExecutablePath || "ruby" ,
You can’t perform that action at this time.
0 commit comments