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

Accept soft modifiers separated by blank lines #230

Closed
nicolasstucki opened this issue Apr 20, 2022 · 2 comments
Closed

Accept soft modifiers separated by blank lines #230

nicolasstucki opened this issue Apr 20, 2022 · 2 comments
Labels
enhancement New feature or request Scala 3

Comments

@nicolasstucki
Copy link
Contributor

See scala/scala3#14959

@nicolasstucki nicolasstucki added enhancement New feature or request Scala 3 labels Apr 20, 2022
@Jentsch
Copy link
Contributor

Jentsch commented Oct 8, 2024

I don't think this can be accomplished correctly using tmlanguage.

From the spec:

Note that the regular expressions are matched against only a single line of the document at a time. That means it is not possible to use a pattern that matches multiple lines. [...]

The only way around that is to use a begin and end rule, but can't count the lines or see what's in between begin and end. Which prevents us from disquishing between this two cases:

// Should be highlighted  
transparent
inline def f2 = 2

// Should be not highlighted, because of the is empty line
transparent

inline def f3 = 3

(Shorted test case from scala/scala3#14959)

With this limitation in mind I see two options:

  • Always color soft keywords as keywords regardless if they are actually keywords
  • Only color soft keywords, if they are on the same line (current behaviour)

Out of those two option I think the current behaviour is the better one and those this issue can be closed as wont-fix.

@tgodzik
Copy link
Contributor

tgodzik commented Oct 8, 2024

Thanks for investigating! Semantic highlighting in scalameta/metals will also be able to help in this case

@tgodzik tgodzik closed this as not planned Won't fix, can't repro, duplicate, stale Oct 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request Scala 3
Projects
None yet
Development

No branches or pull requests

3 participants