| Commit message (Collapse) | Author | Age | Files | Lines |
| | |
|
| | |
|
| | |
|
| | |
|
| | |
|
| | |
|
| | |
|
| | |
|
| | |
|
| | |
|
| | |
|
| | |
|
| | |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Problem: Sharing highlight queries with upstream tree-sitter and
Helix is difficult.
Solution: Where reasonable, use capture names in tree-sitter's standard
list or Helix's Atom-style hierarchy.
Specifically:
* tree-sitter "standard capture names"
(https://github.com/tree-sitter/tree-sitter/blob/3f44b896852eb7daaa6df4fb778c9bb52c70c815/highlight/src/lib.rs#L20-L72):
- `@parameter` -> `@variable.parameter`
- `@field` -> `@variable.member`
- `@namespace` -> `@module`
- `@float` -> `@number.float`
- `@symbol` -> `@string.special.symbol`
- `@string.regex` -> `@string.regexp`
- `@text.*` -> `@markup.*` (`strong`, `italic`, `link`, `strikethrough`; with exceptions; see below)
- `@text.title` -> `@markup.heading`
- `@text.literal` -> `@markup.raw`
- `@text.reference` -> `@markup.link`
- `@text.uri` -> `@markup.link.url` (in markup links)
- `@string.special` -> `@markup.link.label` (non-url links)
- `@punctuation.special` -> `@markup.list` (markdown lists only; move subitems from `@text.todo`)
* Helix captures
(https://docs.helix-editor.com/master/themes.html#syntax-highlighting):
- `@method` -> `@function.method`
- `@method.call` -> `@function.method.call`
- `@text.{todo,warning,note,danger}` -> `@comment.{error,warning,hint,info,todo}`
- `@text.diff.{add,delete,}` -> `@diff.{plus,minus,delta}`
- `@text.uri` -> `@string.special.url` (outside markup)
- `@preproc` -> `@keyword.directive`
- `@define` -> `@keyword.directive`(`.define`?)
- `@storageclass` -> `@keyword.storage`
- `@conditional` -> `@keyword.conditional`
- `@debug` -> `@keyword.debug`
- `@exception` -> `@keyword.exception`
- `@include` -> `@keyword.import`
- `@repeat` -> `@keyword.repeat`
* cleanup
- remove some redundant `@conceal` (but still allow it for conceal-only patterns)
- remove obsolete `@error` (syntax linting is out of scope for this repo)
- sort, cleanup capture list in `CONTRIBUTING.md`
|
| | |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This change does two main things:
1. Indicate that `(for_expression)`'s introduce a `@scope` (this
is the scope for the enumerators to be used within the loop).
2. Indicate that the `(identifiers)` within the `(enumerators)` are
`@definition.var`s.
---
For the following example snippet:
```scala
val fruits = List("apple", "banana", "avocado", "papaya")
val countsToFruits = fruits.groupBy(fruit => fruit.count(_ == 'a'))
for ((count, fruits) <- countsToFruits) {
println(s"with (fruits) 'a' × $count = $fruits")
}
```
The `count` and `fruits` identifiers are new definitions introduced by
the `for` expressions scope.
|
| | |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
When you have a lambda expression like:
```scala
val fruits = List("apple", "banana", "avocado", "papaya")
val countsToFruits = fruits.groupBy(fruit => fruit.count(_ == 'a'))
for ((count, fruits) <- countsToFruits) {
println(s"with (fruits) 'a' × $count = $fruits")
}
```
The `fruit => fruit.count(_ == 'a')` lambda expression (note: without
wrapping parenthesis) does not create a `(binding)` node. Its syntax
tree is:
```
(lambda_expression) ; [5:18 - 47]
parameters: (identifier) ; [5:18 - 22]
(call_expression) ; [5:27 - 47]
function: (field_expression) ; [5:27 - 37]
value: (identifier) ; [5:27 - 31]
field: (identifier) ; [5:33 - 37]
arguments: (arguments) ; [5:38 - 47]
(infix_expression) ; [5:39 - 46]
left: (wildcard) ; [5:39 - 39]
operator: (operator_identifier) ; [5:41 - 42]
right: (character_literal) ; [5:44 - 46]
```
That example just _happens_ to be **exactly** one of the example from
https://www.scala-lang.org/ ([see
playground](https://scastie.scala-lang.org/S0bkCiXkQiuOMXnlhWn46g)) 😁.
|
| |
|
|
|
|
|
|
|
| |
Since 0.9, @lang syntax is still available as fallback but will soon be deprecated.
Because of that, new syntax should be adopted once 0.9 becomes the
baseline requirements for nvim-treesitter
- update health check
- update doc
|
| |
|
|
|
|
| |
This accounts for a correction in interpolations and also adding support
for `self_type`.
This is a follow-up to #4920.
|
| | |
|
| |
|
| |
This accounts for the updates in https://github.com/tree-sitter/tree-sitter-scala/pull/273.
|
| |
|
| |
`@scope` included `function_declaration` while is should have included `function_definition` instead. The former one is used to declare abstract functions while the latter one is used to define functions together with their bodies.
|
| | |
|
| |
|
|
|
|
| |
This syncs the queries that were updated in https://github.com/tree-sitter/tree-sitter-scala/pull/196.
Co-authored-by: ghostbuster91 <ghostbuster91@users.noreply.github.com>
|
| | |
|
| |
|
|
|
|
|
|
|
| |
This is a small change that comes from the discussion we had in
https://github.com/tree-sitter/tree-sitter-scala/discussions/168#discussioncomment-4718624.
The idea here is that we're sort of making an assumption on what an
uppercase identifier is in Scala and more times than not, it's actually
a `@type`. So this changes the `@constant` capture to a `@type` one. You
can find the full context in the linked discussion.
|
| | |
|
| | |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
There has been a lot of changes recently to the Scala grammar and we've
been merging in a handful of things before syncing the actual generated
parser. We are currently at a stage where we're going to sync
everything, but there are some breaking changes that are included in
https://github.com/tree-sitter/tree-sitter-scala/pull/135, so when that
commit gets synced here stuff will break. We've taken the queries that
existed here and have been building off of them in the actual upstream
repo. This will hopefully make the transition smooth and updates the
queries to ensure that there is no breakage. It's recommended to wait
until that pr is merged, synced here, and then merge this in around the
same time.
Co-authored-by: eugene yokota <eed3si9n@gmail.com>
Co-authored-by: Anton Sviridov <keynmol@gmail.com>
|
| | |
|
| | |
|
| | |
|
| |
|
|
| |
as string.find is much quicker than vim.regex:match*
|
| | |
|
| |
|
|
| |
Add fold for scala val definition to support type class entries
|
| | |
|
| |
|
|
|
|
|
|
|
|
|
|
| |
* add highlights for imports
* add highlights for type constructors
* add highlights for constants
* add highlights for interpolation string
* add highlights for comments through injection
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* add type highlights
* add call expression highlights
* add function definition highlights
* add expression highlights
* add literals highlights
* add operator highlights
* add punctuation highlights
* add comment highlights
Co-authored-by: Stevan Milic <stevan.milic@tradecore.com>
|
|
|
* add keywords to scala highlights
* special capture for special keywords
* add while to 'repeat' capture
* pr cleanup, exmaples in CONTRIBUTING.md
* add backquotes for consistency in docs
* group @repeat keywords, fix null
* comment-out 'macro' and 'forSome'
* fix 'this' and 'super' keyword
* remove accidental files :facepalm:
* update revision
* fix "super" and "this"
* godammit these .metals files are killing me
* why did I commit this???
Co-authored-by: Stuart Mashaal <smashaal@hopper.com>
|