nvim-treesitter / nvim-treesitter-refactor

Refactor module for nvim-treesitter
Apache License 2.0
407 stars 25 forks source link

[smart_rename] Did not work when rename variable more than one time #25

Open hiberabyss opened 3 years ago

hiberabyss commented 3 years ago

For the following function, the second time will fail when try to rename test twice:

void hello() {
  int test3 = 123;
  test3 = 456;
  std::cout << test3 << std::endl;
}
stsewd commented 3 years ago

Hi, can you be more specific. What you mean with "rename twice"?

I tried

void hello() {
  int test3 = 123;
  test3 = 456;
  std::cout << test3 << std::endl;
}

With the cursor under int test3 =, rename to test, and then again, rename to test2. It works as expected for me.

hiberabyss commented 3 years ago

Hi, can you be more specific. What you mean with "rename twice"?

I tried

void hello() {
  int test3 = 123;
  test3 = 456;
  std::cout << test3 << std::endl;
}

With the cursor under int test3 =, rename to test, and then again, rename to test2. It works as expected for me.

For my case, there will be following wrong indication when try to rename test:

image

stsewd commented 3 years ago

@hiberabyss can you provide the exact steps (and the cursor position) with a minimal init.vim?