Add rename capability#127
Conversation
|
Just note that renaming in Stan is not trivial, due to overloading and shadowing. functions {
void foo(int x){} // 1
void foo(real x){} // 2
}
generated quantities {
foo(3.14); // 3
}Renaming 1 should probably not change 3, but renaming two should. The easiest thing to do might just be rename all of 1,2 and 3 together, but that's not always what you wanted. Similarly, you can have a variable and a function both named |
|
Yes, I agree 100%! Since now we have a treesitter parser, we should be able to actually handle these things correctly. And we should have tests for cases like these. I'm sure you can come up with great tests, so when we are ready for it, it would be great if you could contribute! |
|
I'm not positive tree-sitter alone will be enough, since some of those cases rely on how typing analysis is done, but it will certainly help |
|
I see... ok, let's see what we can do here. Maybe we need to be more sophisticated. |
bb2ca02 to
e5eda48
Compare
|
@WardBrian It's not quite ready, but it's getting there. Take a look if you find some time. There are still some cases for which renaming doesn't work, and it only works for the file you are in. I'm positive that we are going to get this sorted out. |
@WardBrian This is still WIP, but I thought I'd push it anyway so you can observe what's going on. That way, you don't have to look at one big diff.