Commit Graph

14 Commits (ee2e9ab164809b648b47082151f62e920ca98d4b)

Author SHA1 Message Date
susliko f8d3848919 Fix parenthesized expressions in braceless `if` conditions
Fixes #263 and #342
`_if_condition` extracted from `if_expression` and given a magic dynamic
precedence of 4
2023-09-18 21:48:31 +07:00
Johannes Coetzee 6f9683bbfb Handle quote dollar escape case as well 2023-07-21 10:01:38 +07:00
Johannes Coetzee f894d1d0cd Add highlighting test 2023-07-20 18:47:29 +07:00
Kasper Kondzielski 7d348f51e4
fix: Incorrect string interpolation highlighting group (#196)
* fix: Incorrect string interpolation highlighting group

Co-authored-by: ghostbuster91 <ghostbuster91@users.noreply.github.com>
2023-03-15 22:28:35 +07:00
Chris Kipp 8c11afe211 refactor(queries): change uppercase from constant to type
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.
2023-01-20 16:51:17 +07:00
Chris Kipp 65316edadd test: just a few more highlight tests
I was confirming a couple things locally so figured
I'd just push these up.
2023-01-18 12:32:17 +07:00
Chris Kipp 71b408eed0 feat: add an explicit interpolator field
_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`.
2023-01-18 08:21:39 +07:00
Chris Kipp b49a1fca34
chore: sync highlights back with nvim-treesitter (#148) 2023-01-15 11:16:57 +07:00
eugene yokota 5991810787
Merge pull request #130 from ghostbuster91/structural-types-2
Add support for structural types
2023-01-12 13:54:45 +07:00
ghostbuster91 bfa99af075 Add highlight tests for structural types 2023-01-12 19:10:06 +07:00
Eugene Yokota a5ee1d6053 Use storageclass
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.
2023-01-12 11:34:30 +07:00
Eugene Yokota 77ea27edbe Fixes instance_expression
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`.
2023-01-11 19:15:42 +07:00
Eugene Yokota d6fc64c43b Add hightlight test for self type 2023-01-09 14:44:31 +07:00
Anton Sviridov c69a3eccc8 Update query highlights and add tests 2023-01-08 13:42:33 +07:00