tree-sitter / tree-sitter-scala

Scala grammar for tree-sitter

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Return type on new line

hugo-vrijswijk opened this issue · comments

Commit of tree-sitter-scala you tested this on

cda0de8

A code sample showing the error

object test {
  def column()
      : Int = 4
}

Show the error node

(compilation_unit [0, 0] - [4, 0]
  (object_definition [0, 0] - [3, 1]
    name: (identifier [0, 7] - [0, 11])
    body: (template_body [0, 12] - [3, 1]
      (function_definition [1, 2] - [2, 15]
        name: (identifier [1, 6] - [1, 12])
        parameters: (parameters [1, 12] - [1, 14])
        (ERROR [2, 6] - [2, 6])
        return_type: (type_identifier [2, 8] - [2, 11])
        body: (integer_literal [2, 14] - [2, 15])))))
/Users/hvanrijswijk1/ws/test.scala	0 ms	(ERROR [2, 6] - [2, 6])

What do you expect the tree to look like

Similar to this (return type on same line):

(compilation_unit [0, 0] - [3, 0]
  (object_definition [0, 0] - [2, 1]
    name: (identifier [0, 7] - [0, 11])
    body: (template_body [0, 12] - [2, 1]
      (function_definition [1, 2] - [1, 23]
        name: (identifier [1, 6] - [1, 12])
        parameters: (parameters [1, 12] - [1, 14])
        return_type: (type_identifier [1, 16] - [1, 19])
        body: (integer_literal [1, 22] - [1, 23])))))

Where are you experiencing this error?

No response

@hugo-vrijswijk Thanks for reporting!