Skip to content

"Rename Symbol" often fails to rename when using Rope #52

Closed

Description

@NickGrattan

Environment data

VS Code version: 1.18.0
Python Extension version: 0.8.0
Python Version: 3.5.3 Anaconda 4.0.0
OS and version: Widows 10 Professional

Actual behavior

"Symbol Rename" for a Python symbol fails to rename in about 50% of cases. The symbol remains as its old name and is not renamed

Expected behavior

Rename to rename symbols everytime.

Steps to reproduce:

  • Select symbol (e.g. "node"), choose "Rename Symbol" from context menu
  • Enter new symbol name (e.g. "node2")
    image
  • Press Enter
    Symbol may not be renamed

Logs

Output from Python output panel
No output

Output from ```Console window``` (Help->Developer Tools menu)
No output

Activity

  1. brettcannon commented on Dec 20, 2017

    @brettcannon
    Member

    I can verify this is an issue. Using the following code:

    def fxn():
        B = 42
        Y = B + 13
        return B + Y

    I just simply tried renaming B multiple times in a row and after about 3 times it started to work about every other time. Not sure if this is our doing or Rope's doing.

  2. puzzler10 commented on Mar 9, 2018

    @puzzler10

    Actually, when I tried doing rename on that code (changing B to O) it went from

    def fxn():
        B = 42
        Y = B + 13
        return B + Y
    

    to

    def fxn():
        Y = O + 13
        return O + Y
    

    deleting a line completely.

  3. brettcannon commented on Mar 9, 2018

    @brettcannon
    Member

    Tom Roth (@puzzler10) can you open a new issue?

  4. fredrikaverpil commented on Apr 25, 2018

    @fredrikaverpil

    I'm on the latest vscode (to date) and I find renaming symbols is a "hit or miss" feature. Feels like there's a 50% chance it works with Python code.

  5. brettcannon commented on Apr 25, 2018

    @brettcannon
    Member

    Fredrik Averpil (@fredrikaverpil) the trickiness with this is knowing whether this is our fault or rope not working properly.

  6. fredrikaverpil commented on Apr 25, 2018

    @fredrikaverpil

    Brett Cannon (@brettcannon) I understand. Hm. When it misses the next time, is there any way I troubleshoot it and investigate whether it is rope's fault?

    EDIT: And by the way, thanks for an absolutely fantastic product. I live and breathe Python in vscode at least 8hrs a day 😉

  7. brettcannon commented on Apr 25, 2018

    @brettcannon
    Member

    Fredrik Averpil (@fredrikaverpil) not at the moment; we have #1131 for adding logging throughout the extension as that's a major shortcoming we have.

    And thanks for the compliment!

  8. 24 remaining items

  9. BBI-DiWang commented on Apr 11, 2019

    @BBI-DiWang

    same issue, can not solve it. "find all references" stopped working as well.

  10. brettcannon commented on Apr 11, 2019

    @brettcannon
    Member

    We're actively working to getting renaming working with our new language server which should replace our need to rely on Rope.

  11. calvin620707 commented on Apr 12, 2019

    @calvin620707

    We're actively working to getting renaming working with our new language server which should replace our need to rely on Rope.

    I already disabled Jedi and using language server. Is this the reason why I can't use rename with rope?

  12. BBI-DiWang commented on Apr 12, 2019

    @BBI-DiWang

    I added python.jediEnabled": true in the settings.json, temporary solution.

  13. brettcannon commented on Apr 12, 2019

    @brettcannon
    Member

    Calvin Wu (@calvin620707) correct, but the new language server has built-in support (at least in the beta channel as of version 0.2.53).

  14. karrtikr commented on Apr 17, 2019

    @karrtikr

    FAIL CASE

    Rename Symbol ALWAYS fails without error when NO WORKSPACE FOLDER is open. (#5301)

  15. ThatAIGeek commented on Jul 2, 2019

    @ThatAIGeek

    Are there any plans to fix this? I'm still getting this with Version: 1.35.1

  16. v-kydela commented on Jul 2, 2019

    @v-kydela

    Kartik Raj (@karrtikr) - I notice that you closed that other issue, saying it is working as desired. VSCode gives no explanation for why the rename failed. That hardly seems like desirable behavior.

  17. brettcannon commented on Jul 3, 2019

    @brettcannon
    Member

    Andrii Boichuk (@ThatAIGeek) there's nothing really to fix directly; Rope simply failed and we don't control Rope. Please try the language server to see if it's renaming support works for you (see #3977 for instructions on how to do that).

    Kyle Delaney (@v-kydela) as I mention above, Rope only provides us so much. Please try the language server to see if it does the renaming you want as that we do control and can fix.

  18. fireattack commented on Jul 3, 2019

    @fireattack

    I'm a little confused. So disabling Jedi will enable language server instead, right? But how it's related to rope? Are rope and Jedi the same thing?

  19. brettcannon commented on Jul 3, 2019

    @brettcannon
    Member

    fireattack Correct, disabling Jedi will activate the language server. It's related to Rope because the language server subsumes functionality of Jedi, Rope, and Pylint for the extension. So if you turn on the language server we do not use Jedi or Rope and we stop prompting you to install Pylint to get syntax errors and such (but it will still run, it's just more of an opt-in thing).

  20. brettcannon commented on Jul 29, 2019

    @brettcannon
    Member

    Closing as this is an upstream issue which we don't have direct control or influence over.

  21. locked as resolved and limited conversation to collaborators on Aug 5, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugIssue identified by VS Code Team member as probable bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions