Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Timeout Issue? #1228

Closed
tripptuttle opened this issue May 12, 2022 · 5 comments
Closed

Timeout Issue? #1228

tripptuttle opened this issue May 12, 2022 · 5 comments

Comments

@tripptuttle
Copy link

Running in VS Code with Prettier plugin, plugin-ruby installed with NPM, every time I try to parse I am getting this error shown below. I've increased time to: PRETTIER_RUBY_TIMEOUT_MS=50000

I've tried multiple times, only one time about of 20 did the code actually re-format. And, this error comes up much quicker than 50 seconds.

Any troubleshooting tips?

Metadata

  • Operating system: MacOS 12.3.1 M1
  • Ruby version: 3.1.2
  • Node version: v17.8.0
  • @prettier/plugin-ruby or prettier gem version: latest
  • syntax_tree version: latest

Input

# frozen_string_literal: true

class Test88ComponentPreview < ViewComponent::Preview
  def default
    render(Test88Component.new(title: "title"))
  end
end

Error

["INFO" - 2:50:53 PM] Formatting file:///Users/mst49/workspace/sps-ui/test/components/previews/test_88_component_preview.rb
["INFO" - 2:50:53 PM] Using config file at '/Users/mst49/workspace/sps-ui/.prettierrc.yml'
["INFO" - 2:50:53 PM] Using ignore file (if present) at /Users/mst49/workspace/sps-ui/.prettierignore
["INFO" - 2:50:53 PM] File Info:
{
  "ignored": false,
  "inferredParser": "ruby"
}
["INFO" - 2:50:53 PM] Detected local configuration (i.e. .prettierrc or .editorconfig), VS Code configuration will not be used
["INFO" - 2:50:53 PM] Prettier Options:
{
  "filepath": "/Users/mst49/workspace/sps-ui/test/components/previews/test_88_component_preview.rb",
  "parser": "ruby",
  "trailingComma": "es5",
  "tabWidth": 4,
  "semi": false,
  "singleQuote": true
}
["ERROR" - 2:50:58 PM] Error formatting document.
Error: 
      We failed to spawn our parser server. Please report this error on GitHub
      at https://github.com/prettier/plugin-ruby. The error message was:

        /Users/mst49/workspace/sps-ui/node_modules/@prettier/plugin-ruby/src/getInfo.js:12
  throw new Error(`Failed to get information from parse server in time. If this
  ^

Error: Failed to get information from parse server in time. If this
    happens repeatedly, try increasing the PRETTIER_RUBY_TIMEOUT_MS environment
    variable beyond 5000.
    at Timeout._onTimeout (/Users/mst49/workspace/sps-ui/node_modules/@prettier/plugin-ruby/src/getInfo.js:12:9)
    at listOnTimeout (node:internal/timers:559:17)
    at processTimers (node:internal/timers:502:7)

Node.js v17.8.0
.
    
	at spawnServer (/Users/mst49/workspace/sps-ui/node_modules/@prettier/plugin-ruby/src/parseSync.js:155:11)
	at parseSync (/Users/mst49/workspace/sps-ui/node_modules/@prettier/plugin-ruby/src/parseSync.js:180:18)
	at Object.parse (/Users/mst49/workspace/sps-ui/node_modules/@prettier/plugin-ruby/src/plugin.js:85:16)
	at Object.parse (/Users/mst49/workspace/sps-ui/node_modules/prettier/index.js:7361:23)
	at coreFormat (/Users/mst49/workspace/sps-ui/node_modules/prettier/index.js:8672:18)
	at formatWithCursor2 (/Users/mst49/workspace/sps-ui/node_modules/prettier/index.js:8864:18)
	at /Users/mst49/workspace/sps-ui/node_modules/prettier/index.js:39174:12
	at Object.format (/Users/mst49/workspace/sps-ui/node_modules/prettier/index.js:39188:12)
	at t.default.format (/Users/mst49/.vscode/extensions/esbenp.prettier-vscode-9.5.0/dist/extension.js:1:13489)
	at async t.PrettierEditProvider.provideEdits (/Users/mst49/.vscode/extensions/esbenp.prettier-vscode-9.5.0/dist/extension.js:1:10196)
	at async z.provideDocumentFormattingEdits (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/api/node/extensionHostProcess.js:83:105121)
["INFO" - 2:50:58 PM] Formatting completed in 5.201ms.
@kddnewton
Copy link
Member

Have you installed the requisite gems from the README?

@kddnewton
Copy link
Member

I'm going to assume it's the gems that aren't installed. Let me know if that doesn't fix it and I'll reopen.

@nadnoslen
Copy link

I'm also experiencing this timeout problem after allowing Dependabot to upgrade from 2.1.0 to 3.1.2.

I thought it would be an easy fix after following @kddnewton's advice by installing the additional gems that I had no idea were required ...

gem install bundler prettier_print syntax_tree syntax_tree-haml syntax_tree-rbs

... perhaps the changelog should mention this breaking change for developer's using node prettier? I'd fork and update the prettier/plugin-ruby changelog myself, but I'm not 100% confident in my suggesting that edit until I fix this problem locally for myself.

After installing the additional gems, I'm now able to format from the command line 👍

Unfortunately formatting from VS Code continues to time out with the same error reported by @tripptuttle. I've reloaded my VS Code project with no success. I must be missing something.

My rubocop is also blowing up with Style/StringLiterals errors likely because it can't seem to inherit the rubocop config file which appears to have been in 3.1.1 🤷‍♂️

I'm heading back to 2.1.0 for now.

I hope some of my experience helps diagnose the problem. Thanks for this great formatting extension which has been terrific up to this little speed-bump.

@oboje
Copy link

oboje commented May 22, 2023

the same context, does not work for me

@igz0
Copy link

igz0 commented Aug 7, 2023

When VSCode is launched from Alfred, it times out.
In my environment, this does not occur when VSCode is started from the Applications directory.

This is probably due to permissions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants