Closed
Description
Commit of tree-sitter-scala you tested this on
HEAD
A code sample showing the error
test-plugins.sbt
addSbtPlugin("com.indoorvivants.vcpkg" % "sbt-vcpkg-native" % "0.0.11")
// hello
Show the error node
Run with npm exec -- tree-sitter parse test-plugins.sbt
(compilation_unit [0, 0] - [2, 0]
(ERROR [0, 0] - [2, 0]
(comment [1, 0] - [1, 8])))
test-plugins.sbt 0 ms (ERROR [0, 0] - [2, 0])
What do you expect the tree to look like
Correctly parsed
Where are you experiencing this error?
No response
Notes
This is technically not valid Scala, you can't have top level expressions:
val x = 25
println(x)
@main def hello = ???
Compiling project (Scala 3.2.0, JVM)
[error] ./test.scala:2:1: Illegal start of toplevel definition
[error] println(x)
[error] ^^^^^^^
Error compiling project (Scala 3.2.0, JVM)
Compilation failed
But it's valid in the context of SBT.
@olafurpg patched it in Sourcegraph's fork, but that breaks most tests: sourcegraph@6cd3cb6 so we will likely need to rejig other parts of the grammar.
The question of whether we allow it unconditionally is open, but for the purposes of syntax highlighting IMO we should.
Metadata
Metadata
Assignees
Labels
No labels