Skip to content

[kt] Suggestion: Highlight common scope functions #256

@wesalvaro

Description

@wesalvaro

Scope functions are very important to the readability of Kotlin as they can change the context or introduce a variable without much fanfare. I would recommend that we highlight scope functions similar to a when block. This should include all the obvious scope functions (also, apply, let, run, and with). I also think it should include other methods that introduce a scope (e.g. forEach)

foo.apply {  // apply should be highlighted
  bar().forEach {  // forEach should be highlighted
    // ...
  }
  addListener("click") {  // No special highlight
    // ...
  }
}

It looks like GitHub's highlighter already highlights apply.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions