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

Guard against format requests for files that don't yet exist on disk #102

Closed
xeger opened this issue Jun 23, 2022 · 1 comment · Fixed by #109
Closed

Guard against format requests for files that don't yet exist on disk #102

xeger opened this issue Jun 23, 2022 · 1 comment · Fixed by #109

Comments

@xeger
Copy link
Contributor

xeger commented Jun 23, 2022

Steps to reproduce:

  1. Install vscode-syntax-tree & make sure it's in working order on existing source files
  2. Use code foo.rb to open a buffer with a name, on a file that doesn't yet exist on disk
  3. Type some Ruby code into the buffer to trigger a textDocument/inlayHints request

Outcome: the stree process crashes with ENOENT

Desired: the process recovers from file-not-exist (either by failing the jsonrpc request, or perhaps by grabbing fresh content from the request and putting it into the store).

Full backtrace here:

<snip>/syntax_tree-2.8.0/lib/syntax_tree/language_server.rb:26:in `binread': No such file or directory @ rb_sysopen - /tmp/bar.rb (Errno::ENOENT)
	from <snip>/syntax_tree-2.8.0/lib/syntax_tree/language_server.rb:26:in `block in run'
	from <snip>/syntax_tree-2.8.0/lib/syntax_tree/language_server.rb:68:in `run'
	from <snip>/syntax_tree-2.8.0/lib/syntax_tree/cli.rb:262:in `run'
	from <snip>/syntax_tree-2.8.0/exe/stree:9:in `<top (required)>'
@kddnewton
Copy link
Member

Tangential but related to this is #103, because that should make it so that these requests never get fired in the first place.

kddnewton added a commit that referenced this issue Jul 5, 2022
Fix for #102, handle files not existing
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

Successfully merging a pull request may close this issue.

2 participants