Skip to content

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

Closed
@xeger

Description

@xeger

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)>'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions