Skip to content

Code causes syntax tree to crash #160

Closed
@vwall

Description

@vwall

Looking at this issue #129 and it seems to work correctly from the CLI

example code:

LongRecordName.transaction do
  LongRecordName
    .joins(:other_record)
    # rubocop:disable Rails/SkipsModelValidations

    .update_all(foo: 'bar')
end

CLI:

Error: Cannot find expected end
> 1 | LongRecordName.transaction do
    |                            ^
  2 |   LongRecordName
  3 |     .joins(:other_record)
  4 |     # rubocop:disable Rails/SkipsModelValidations
The listed files did not match the expected format.

However in vscode it crashes synax-tree and there is nothing indicating that something is wrong. Is this the correct behavior?

VSCODE:

/Users/nix/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/syntax_tree-3.6.0/lib/syntax_tree/parser.rb:251:in `find_token': Cannot find expected end (SyntaxTree::Parser::ParseError)
	from /Users/nix/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/syntax_tree-3.6.0/lib/syntax_tree/parser.rb:1242:in `on_do_block'
	from /Users/nix/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/syntax_tree-3.6.0/lib/syntax_tree.rb:47:in `parse'
	from /Users/nix/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/syntax_tree-3.6.0/lib/syntax_tree.rb:47:in `parse'
	from /Users/nix/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/syntax_tree-3.6.0/lib/syntax_tree.rb:54:in `format'
	from /Users/nix/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/syntax_tree-3.6.0/lib/syntax_tree/language_server.rb:90:in `format'
	from /Users/nix/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/syntax_tree-3.6.0/lib/syntax_tree/language_server.rb:59:in `run'
	from /Users/nix/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/syntax_tree-3.6.0/lib/syntax_tree/cli.rb:410:in `run'
	from /Users/nix/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/syntax_tree-3.6.0/exe/stree:9:in `'
	from /Users/nix/.asdf/installs/ruby/3.1.2/bin/stree:25:in `load'
	from /Users/nix/.asdf/installs/ruby/3.1.2/bin/stree:25:in `
' [Info - 5:29:20 PM] Connection to server got closed. Server will restart.

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