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

Format type signatures in hover tooltip #301

Open
tanishiking opened this issue Sep 8, 2022 · 2 comments
Open

Format type signatures in hover tooltip #301

tanishiking opened this issue Sep 8, 2022 · 2 comments

Comments

@tanishiking
Copy link
Member

Is your feature request related to a problem? Please describe.

When we hover on a symbol whose type signature is complex (e.g. check method in Metals), we'll see the following type signature that is cluttered and hard to read.

Screen Shot 2022-09-08 at 14 25 10

Describe the solution you'd like

It would be awesome if the type signature in the hover tooltip is formatted like

  def check(
      name: TestOptions,
      original: String,
      expected: String,
      includeDocs: Boolean = false,
      includeCommitCharacter: Boolean = false,
      compat: Map[String, String] = Map.empty,
      postProcessObtained: String => String = identity,
      stableOrder: Boolean = true,
      topLines: Option[Int] = None,
      filterText: String = "",
      includeDetail: Boolean = true,
      filename: String = "A.scala",
      filter: String => Boolean = _ => true,
      enablePackageWrap: Boolean = true,
  )(implicit loc: Location): Unit

instead of packing everything in one line. (not sure it's possible though).

Describe alternatives you've considered

not sure

Additional context

hover

Search terms

hover, type signature

@jkciesluk
Copy link
Member

jkciesluk commented Sep 14, 2022

I think we can change it here

https://github.com/scalameta/metals/blob/1addbf1044ba2f5a37a8664c68a822ad0de026ee/mtags/src/main/scala-3/scala/meta/internal/pc/printer/MetalsPrinter.scala#L293-L319

The question is, should we always format or only if the definition is complex? If so, how we define complex?

@tanishiking
Copy link
Member Author

I was thinking maybe we can apply scalafmt over the signatures (with appropriate column setting), but it's not ideal because maybe it takes some additional time to show the signatures.

Alternatively, maybe we can define the complexity based on the number of parameters 🤔

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants