Skip to content

Parameter hints not working for functions #7532

@TomasMikula

Description

@TomasMikula

Describe the bug

Parameter hints (the "Trigger Parameter Hints" command) work for methods, but not for functions (not even for the apply method of functions).

def method(x: Int, y: String): Unit =
  ()

val function: (x: Int, y: String) => Unit =
  (_, _) => ()

def test: Unit =
  method(1, "one")         // Good: parameter hints work
  function(1, "one")       // Bad: parameter hints don't work
  function.apply(1, "one") // Bad: parameter hints don't work

In each of the screenshots below, I triggered the "Trigger Parameter Hints" from the Command Palette:

Image

Worked for method:

Image

Didn't work for function or function.apply:

Image

Image

Interestingly, "Trigger Suggest" (Ctrl + Space) before the opening paren does show the parameter names and types, so I suppose Metals should have all the information available:

Image

Expected behavior

Trigger Parameter Hints action should show parameter hints for functions (because it's useful 😊, but also because calling a function means calling it's apply method).

Operating system

macOS

Editor/Extension

VS Code

Version of Metals

v1.5.3

Extra context or search terms

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething that is making a piece of functionality unusablespree

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions