Skip to content

Commit

Permalink
[Scala] Add support for Scala 3 (#4124)
Browse files Browse the repository at this point in the history
* [Scala] Added support for new control syntax

* [Scala] Implemented support for braceless block syntax (suffix colon)

* [Scala] Added support for `end`

* [Scala] Added tests for new wildcards

* [Scala] Added support for `given`

* [Scala] Added support for extensions

* [Scala] Added support for enums

* [Scala] Added support for type lambdas and cleaned up broken things

* [Scala] Added support for context function types and fixed scoping

* [Scala] Implemented support for opaque types and intersect/unions

* [Scala] Added support for dependent function types

* [Scala] Fixed missing punctuation scope for lambda parameters

* [Scala] Added support for type lambdas and cleaned up dependent types

* [Scala] Added support for match types (grumble grumble)

* [Scala] Added tests for trait parameters

* [Scala] Added support for `transparent` and `inline`

* [Scala] Added support for `export` and `as` renames

* [Scala] Better handling of soft modifiers

* [Scala] Still-better soft modifier handling

* [Scala] Added support for literal types

* [Scala] Updated indentation rules to deal with braceless things as best we can

* [Scala] Added test for #3778

* [Scala] Inverted the order of comment newline eating

* [Scala] Added support for `enum`

* [Scala] Made the typing experience slightly more pleasant for braceless if/else and similar

* [Scala] Fixed self types for newly restrictive lambda syntax
  • Loading branch information
djspiewak authored Jan 7, 2025
1 parent 205e9a2 commit 6aa7e70
Show file tree
Hide file tree
Showing 5 changed files with 1,293 additions and 195 deletions.
17 changes: 0 additions & 17 deletions Scala/Dedentation Rules - case.tmPreferences

This file was deleted.

29 changes: 17 additions & 12 deletions Scala/Indentation Rules.tmPreferences
Original file line number Diff line number Diff line change
Expand Up @@ -9,23 +9,28 @@
<string>(?x)
^ .* \{ [^}"']* $ # curly brace indent
| ^ .* \( [^)"']* $ # paren indent
# if a line ends with `=`, then it's a line-wrapped declaration (e.g. val x = \n)
| ^ .* = \s* $
# if a line ends with `:`, then it's a line-wrapped declaration (e.g. class Foo: \n)
| ^ .* : \s* $
# attempts to detect a line-wrapped control construct without curly braces (e.g. if (foo) \n)
| ^ .* \b(if|do|while|for|match|catch|try|else|yield)\b .* \) \s* $
# any line that starts with extension is an extension now
| ^ \s* extension\b .* $
# case statements have always been braceless, now they can just happen anywhere
| ^ \s* \b(case)\b .* =&gt; .* $
</string>
<key>decreaseIndentPattern</key>
<string>(?x)
^ (.*\*/)? \s* \} .* $ # curly brace dedent
| ^ (.*\*/)? \s* \) .* $ # parent dedent
</string>
<key>bracketIndentNextLinePattern</key>
<string>(?x)
# if a line ends with `=`, then it's a line-wrapped declaration (e.g. val x = \n)
^ .* = \s* $
# attempts to detect a line-wrapped control construct without curly braces (e.g. if (foo) \n)
| ^ .* \b(if|do|while|for)\b .* \) \s* $
# simpler line-wrapped control constructs
| ^ .* \b(else)\b \s* $
| ^ .* \b(yield)\b \s* $
| ^ \s* end ($|\s+ .* $) # end token
| ^ \s* (catch|else|yield) ($|\s+ .* $) # braceless things (I would prefer to also do while/do but we can't)
</string>
</dict>
</dict>
Expand Down
Loading

0 comments on commit 6aa7e70

Please sign in to comment.