plugin-ruby icon indicating copy to clipboard operation
plugin-ruby copied to clipboard

Failed to start parse server

Open wengzilla opened this issue 1 year ago • 7 comments

Currently using VSCode Prettier Plugin v10.4.0 + @prettier/plugin-ruby 4.0.2 + prettier 3.0.3.

I'm getting the following error:

Error: Failed to start parse server.
    at Timeout.<anonymous> (file:///.../node_modules/@prettier/plugin-ruby/src/plugin.js:127:16)
    at listOnTimeout (node:internal/timers:573:17)
    at process.processTimers (node:internal/timers:514:7)

However, if I run ./node_modules/.bin/prettier --plugin=@prettier/plugin-ruby --write '**/*' it works no problem. What's going on?

wengzilla avatar Oct 17 '24 00:10 wengzilla

Same with @prettier/plugin-ruby 4.0.4 + prettier 3.3.3

guillaumewrobel avatar Oct 24 '24 07:10 guillaumewrobel

Same error for me in WSL with @prettier/plugin-ruby 4.0.4 + prettier 3.4.0.

ilya-gritsenko avatar Nov 26 '24 14:11 ilya-gritsenko

Did a little debugging and noticed that it's failing after 'require "syntax_tree"'. So I just tried to execute "bundle add" instead of "gem install" like this: "bundle add prettier_print syntax_tree syntax_tree-haml syntax_tree-rbs" and now it's working. I'm thinking it's because I'm using rbenv but not sure.

UPD: if I delete Gemfile it's starting to work

ilya-gritsenko avatar Nov 26 '24 15:11 ilya-gritsenko

Downgrading to 4.0.2 also helps

ilya-gritsenko avatar Nov 27 '24 07:11 ilya-gritsenko

The issue is resolved after deleting the following line of code:

https://github.com/prettier/plugin-ruby/blob/ed8a2577f5f739365662a64d669ed0e340a40453/src/plugin.js#L79

Introducing an option to disable changing the child process's current working directory could provide a straightforward workaround.

thrnjica avatar Mar 06 '25 14:03 thrnjica

I was hitting this, but updating the editor (VSCode/Cursor) seems to have resolved it for me.

DennisTheMenace780 avatar Mar 21 '25 17:03 DennisTheMenace780

I got:

<internal:/opt/homebrew/Cellar/ruby/3.4.3/lib/ruby/3.4.0/rubygems/core_ext/kernel_require.rb>:136:in 'Kernel#require': cannot load such file -- syntax_tree (LoadError)
Did you mean?  syntax_suggest
        from <internal:/opt/homebrew/Cellar/ruby/3.4.3/lib/ruby/3.4.0/rubygems/core_ext/kernel_require.rb>:136:in 'Kernel#require'
        from /opt/homebrew/Library/Taps/homebrew-x/homebrew-x/node_modules/@prettier/plugin-ruby/src/server.rb:7:in '<main>'
[error] Casks/imfile.rb: Error: Failed to start parse server.
[error]     at Timeout.<anonymous> (file:///opt/homebrew/Library/Taps/homebrew-x/homebrew-x/node_modules/@prettier/plugin-ruby/src/plugin.js:127:16)
[error]     at listOnTimeout (node:internal/timers:594:17)
[error]     at process.processTimers (node:internal/timers:529:7)
<internal:/opt/homebrew/Cellar/ruby/3.4.3/lib/ruby/3.4.0/rubygems/core_ext/kernel_require.rb>:136:in 'Kernel#require': cannot load such file -- syntax_tree (LoadError)
Did you mean?  syntax_suggest
        from <internal:/opt/homebrew/Cellar/ruby/3.4.3/lib/ruby/3.4.0/rubygems/core_ext/kernel_require.rb>:136:in 'Kernel#require'
        from /opt/homebrew/Library/Taps/homebrew-x/homebrew-x/node_modules/@prettier/plugin-ruby/src/server.rb:7:in '<main>'
[error] Casks/sogouinput.rb: Error: Failed to start parse server.
[error]     at Timeout.<anonymous> (file:///opt/homebrew/Library/Taps/homebrew-x/homebrew-x/node_modules/@prettier/plugin-ruby/src/plugin.js:127:16)
[error]     at listOnTimeout (node:internal/timers:594:17)
[error]     at process.processTimers (node:internal/timers:529:7)

OK, after gem install syntax_tree, it's working as expected now.

JounQin avatar Apr 21 '25 11:04 JounQin