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

Inconsistent syntax highlighting with extension method #5630

Closed
iusildra opened this issue Sep 8, 2023 · 4 comments
Closed

Inconsistent syntax highlighting with extension method #5630

iusildra opened this issue Sep 8, 2023 · 4 comments
Labels
bug Something that is making a piece of functionality unusable presentation-compiler Something relating to the presentation compiler Scala 3 Generic ticket relating to Scala 3
Milestone

Comments

@iusildra
Copy link
Contributor

iusildra commented Sep 8, 2023

Describe the bug

Extension methods from top-level extension are correctly highlighted, but if it is nested in the companion object then it appears as a field
image

Expected behavior

Extension method defined in companion object should appear as a method

Operating system

Linux

Editor/Extension

VS Code

Version of Metals

v1.0.1+22-acf9aec2-SNAPSHOT

Extra context or search terms

Semantic highlighting

@kasiaMarek
Copy link
Contributor

kasiaMarek commented Sep 8, 2023

Thanks for the report. In the first example also highlight and go to definition don't work, which should also get fixed.

@kasiaMarek kasiaMarek added bug Something that is making a piece of functionality unusable Scala 3 Generic ticket relating to Scala 3 presentation-compiler Something relating to the presentation compiler labels Sep 8, 2023
@iusildra
Copy link
Contributor Author

iusildra commented Sep 9, 2023

Is there a link between metals presentation compiler's and dotty's ? It seems it's the same code but I do not see any submodule

@kasiaMarek
Copy link
Contributor

The presentation compiler is getting moved from metals to dotty. You can read more here. And here is the initial commit that adds pc to dotty. We are currently in this, a bit awkward, transition state, where the presentation compiler is maintained both in dotty and metals. We have to keep both up to date until the release of LTS 3.3.2, and even after that, it seems prudent to provide bug fixes for older versions such as 3.2.2 for a while longer.

bishabosha added a commit to scala/scala3 that referenced this issue Sep 20, 2023
For:
```Demo.scala
class MyIntOut(val value: Int)
object MyIntOut:
  extension (i: MyIntOut) def uneven = i.value % 2 == 1

val a = MyIntOut(1).uneven
```
`uneven` call in the typed tree has span `<126..126>`, where it should
be `<138..144>`.

connected to: scalameta/metals#5630

I'm open to suggestions on how to do it nicer.
@kasiaMarek
Copy link
Contributor

This is fixed now.

@kasiaMarek kasiaMarek added this to the Metals v1.1.0 milestone Oct 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something that is making a piece of functionality unusable presentation-compiler Something relating to the presentation compiler Scala 3 Generic ticket relating to Scala 3
Projects
None yet
Development

No branches or pull requests

2 participants