apple / sourcekit-lsp

Language Server Protocol implementation for Swift and C-based languages

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Renaming a function shows parentheses as part of the function name

tristanlabelle opened this issue · comments

Steps:

  • Write a foo function declaration and call
  • Right click on either and choose "Rename symbol"
  • A rename popup shows

Actual: The popup is populated with foo()
Expected: The popup is populated with foo

The feature still works, whether or not you delete the (), but this is weird.

rename-symbol-parens

Swift toolchain version:

compnerd.org Swift version 5.11-dev (LLVM 1b1a7d803104731, Swift 3a511e0dc5ec435)
Target: x86_64-unknown-windows-msvc
(main branch build from 2024-01-22)

Tracked in Apple’s issue tracker as rdar://121864405

Renaming func foo(bar: Int) would show foo(bar:) - the parameter names are considered as part of the function name. We could possibly special case the no-arg case though. Thoughts @ahoppen?

Oh so this allows renaming labels alongside with the function name? I think that's not very obvious and my intuition would have been to right click on the label and choose "rename symbol" if I wanted to do that.

Oh so this allows renaming labels alongside with the function name?

Yes. The "name" of a swift function is its base name + any labels.