Skip to content

Renaming not working for functions ending with question mark or equals sign #1032

@schaerl

Description

@schaerl

Environment

  • Pop!_OS 22.04 LTS
  • Ruby 3.4.5 (via rbenv)
  • Solargraph 0.56.2
  • VsCode 1.103.1
  • NeoVim v0.11.3

Description
I cannot rename functions that end with either = or ?. It doesn't work in VSCode or NeoVim with vim.lsp.

In the example below, I can rename the foo method, having the cursor either on the definition or at the call site. This also works with and without parentheses.
For the is_bar? method, I can start renaming on definition or callsite, however, the initial renaming input is the name of the method without the question mark (is_bar), and after confirming a new name, that new name is only applied to the call site, only including a question mark if it was part of the new name
For the baz= method, it doesn't work at all if I rename at the definiton. If I rename at the call site, the new name is applied to the callsite, even removing the space and the equals sign.

Expectation
Renaming also works with those methods, i.e. definition and call sites are updated, and equals and question mark are part of the initial name.

Minimal code

class TestClass
  # works
  def foo(string)
  end

  # Don't work
  def is_bar?
  end
  def baz=(new_baz)
  end
end

TestClass.new.foo 'bar'

TestClass.new.is_bar?

TestClass.new.baz = 'baz'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions