Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Scala] "with" keywords highlighted as out of place when comment between them and extends #3778

Closed
fhunstock-semron opened this issue May 26, 2023 · 1 comment · Fixed by #4124
Labels
C: Syntax T: bug A bug in an existing language feature

Comments

@fhunstock-semron
Copy link

fhunstock-semron commented May 26, 2023

What happened?

Given the following scala code,
this will highlight the with keywords as out of place:

class c()
    extends a()
    // some comment
    with foo with bar {

    }

while the following works fine:

class c()
    extends a()
    with foo with bar {

    }

Tested on build 4143 on the stable channel

@fhunstock-semron fhunstock-semron changed the title [Scala] Comment [Scala] "with" keywords highlighted as out of place when comment between them and extends May 26, 2023
@djspiewak
Copy link
Contributor

This may not actually be solvable.

The problem here is inferring when the class definition ends in general (especially when you don't have an open curly brace) is based on a complex series of rules, most notably including a double newline. This is the same set of rules that applies to other type definitions. The issue in your example is there is a double newline, it's just hidden by the comment. Scala reasonably considers the comment line to be "not blank", but it's harder for Sublime to make the same judgement.

I would definitely like to fix this, but I'm somewhat skeptical that it's in the cards.

@deathaxe deathaxe added T: bug A bug in an existing language feature C: Syntax labels May 26, 2023
djspiewak added a commit to djspiewak/Packages that referenced this issue Dec 31, 2024
deathaxe pushed a commit that referenced this issue Jan 7, 2025
* [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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C: Syntax T: bug A bug in an existing language feature
Projects
None yet
3 participants