tree-sitter now uses last-wins rules for highlighting.
This moves the rules around to match the older highlighting.
Except operator, which I've now let it take precedence over `function.call`.
Summary
-------
Single line `$.comment` is split into a choice of `$._comment_text` and
`$.using_directive` to parse a structure of comments like
```
//> using scala 3.3.0
```
This is in reference to the conversation that was in
https://github.com/tree-sitter/tree-sitter-scala/discussions/168 around
imports and the coloring of the final part. Taken from Eugene's comment,
which made a lot of sense to message
> In Scala we have namespace for terms and types, and they can each
> define the same name, often encouraged as "companion object", so at the
> point of import statement it's ambiguous.
This is relevant in the import case, but I also think I agree with it
most of the time when you have an uppercase identifier. While there may
be times this isn't the case, I think it's a safe default.
_The problem_
Currently when you come across string interpolation you don't get any
special highlighting for the actual interpolator meaning:
```scala
ivy"com.lihaoyi::os-lib:0.9.0"
```
I all colored the same.
_The Solution_
The pr makes 2 changes.
- The `identifier` we use for the interpolator now becomes a field for
no reason other than I thought it'd be nice to just give it a name
- A hightlight query that captures it and assigns it to `function.call`.
Problem
-------
The buffer given for payload serialization is 1024,
but we are currently using (1024 + 3) * sizeof(int)
Solution
--------
Reduce it way down, and fix a few things around unsigned vs int
Problem
-------
Currently storage related modifiers use keyword.
Solution
--------
We should use `storageclass` for `private`, `protected`, and `inline`.
See also https://www.sublimetext.com/docs/scope_naming.html#storage
> Keywords that affect the storage of a variable, function or data structure should use the following scope. Examples include static, inline, const, public and private.
Fixes https://github.com/tree-sitter/tree-sitter-scala/issues/127
Problem
-------
Currently our grammar does not support the fewer braces syntax,
which basically lets us pass the last argument as a block after `:`.
Solution
--------
This implements fewer braces support for call_expression,
infix_expression, with and without the lambda start.
Problem
-------
Current grammar accepts expression immeidately after `new`,
which is not correct, and doesn't work for Scala 3 syntax.
Solution
--------
This fixes it by actually using `$.template_body`.
It does create a tricky conflict between `new A: <block>`
construct and `new A: <type>`.
To deal with that, we are using `prec.dynamic`.
Problem
-------
Currently operator-like identifiers are not part of the simple
expression, so you can't call `::(123)`.
Solution
--------
This includes `$.operator_identifier` into `_simple_expression`,
and further improves the expression hierarchy.
Note that this removes test on double-prefix-expression.
It's not allowed in Scala spec to have double-prefix.
Problem
-------
Given something like
class A:
def l: Int =
1
def m = ()
the scanner doesn't inject automatic semicolon since the newline
has been consumed by outdenting, and it fails to parse the code.
Solution
--------
Track `last_newline_count` in the payload, which represents the
newline_count at the time out outdent.
This then is recovered so automatic semicolon can use it
only if the column position hasn't moved.
Problem
-------
Given something like
class A:
def a() =
()
def a() = 1
the scanner only outdents once, so it fails to parse the above.
Solution
--------
Track `last_indentation_size` in the payload to indicate last
outdent (default: -1). If it's not -1 that means there was an outdent.
This then checks if the last_indentation_size qualified for another
outdent.