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

Improve tool tip for methods that returns an intermediate class #372

Open
DoNotWorr opened this issue Jun 28, 2022 · 0 comments
Open

Improve tool tip for methods that returns an intermediate class #372

DoNotWorr opened this issue Jun 28, 2022 · 0 comments

Comments

@DoNotWorr
Copy link

DoNotWorr commented Jun 28, 2022

Many methods in ZIO are implemented in an intermediate class, like this example.

  /**
   * Accesses the environment of the effect.
   */
  def environmentWith[R]: ZIO.EnvironmentWithPartiallyApplied[R] =
    new ZIO.EnvironmentWithPartiallyApplied[R]
  final class EnvironmentWithPartiallyApplied[R](private val dummy: Boolean = true) extends AnyVal {
    def apply[A](f: ZEnvironment[R] => A)(implicit trace: Trace): URIO[R, A] =
      ZIO.environment.map(f)
  }

The current tool tip for ZIO.environmentWith[Foo] comes only from the first code block, but a lot of the valuable information sits in the second code block. I think both blocks contains valuable information:

  • Actual method signature including parameters and return type
  • Method documentation
  • The name of the method you're using ("def apply") would be confusing
  • Information that the method was implemented with an intermediate class. Otherwise you might get tricked by false hints about implementation.
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

1 participant