Skip to content

Option to avoid auto-inserting parentheses for single-parameter closure methods in autocompletion #455

@jmjoy

Description

@jmjoy

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

When using code completion, Metals automatically inserts parentheses for methods like whenIsActive, resulting in stateHangUp.whenIsActive(). However, this method only takes a closure, and I prefer the style stateHangUp.whenIsActive {}. Having to manually remove the parentheses every time is inconvenient. See attached screenshot for reference.

Completion parentheses example

Describe the solution you'd like

Please provide an option to disable automatic parentheses insertion for methods that only accept a closure, allowing code completion to produce stateHangUp.whenIsActive {} directly (without parentheses).

Describe alternatives you've considered

Manually deleting the parentheses after each completion, but this is repetitive and lowers coding efficiency. Other editors or toolchains sometimes have options for handling this case.

Additional context

This is a common case for Scala methods that take a single closure parameter. Many users prefer the more idiomatic curly brace syntax for such cases.

Search terms

autocomplete, parentheses, completion, closure, code style, brackets

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions