Commit Graph

20 Commits (7dd646ff64bc5eb2286ca85b9d04ecbc4e919697)

Author SHA1 Message Date
Eugene Yokota 7dd646ff64 Refactor highlighting
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`.
2024-03-12 03:05:12 +07:00
Natsu Kagami 25f8fdfb74
Change wrong scala3 test
Old test used to pass due to `lua-match` predicates not being run with `tree-sitter` command
2023-06-30 15:35:53 +07:00
Eugene Yokota fa6ffa149f Add more highlight test 2023-05-26 11:02:37 +07:00
Eugene Yokota e292682508 Match type
This implements support for Scala 3 match types.
2023-05-26 10:18:32 +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 b49a1fca34
chore: sync highlights back with nvim-treesitter (#148) 2023-01-15 11:16:57 +07:00
Eugene Yokota 00cfe78f27 Add tests for optional braces highlights
Fixes https://github.com/tree-sitter/tree-sitter-scala/issues/59
2023-01-13 15:04:49 +07:00
eugene yokota c110fbaece
Merge pull request #128 from eed3si9n/wip/fewer_braces
SIP-44 Fewer braces support
2023-01-12 14:36:28 +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 710e5cccc5 Add the val y = x: Int example 2023-01-12 10:45:32 +07:00
Eugene Yokota ffcbfc90a9 SIP-44 Fewer braces support
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.
2023-01-12 10:45:32 +07:00
Anton Sviridov 94b7758931 Export clauses 2023-01-10 10:34:18 +07:00
Anton Sviridov cbf8207f4c
Extra highlights for scala 3 constructs (#120) 2023-01-10 09:59:00 +07:00
Anton Sviridov 6120785552
Transparent, open, infix (#119) 2023-01-10 09:03:36 +07:00
Eugene Yokota bf4102c863 Include operator-like identifier as simple expression
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.
2023-01-09 18:54:50 +07:00
Anton Sviridov 80cb5ed88f Inline def, if, given, match 2023-01-09 22:48:08 +07:00
Anton Sviridov f05407f2f6 Scala 3 enums: fix simple case inheritance 2023-01-09 21:43:23 +07:00
Anton Sviridov c69a3eccc8 Update query highlights and add tests 2023-01-08 13:42:33 +07:00