Skip to content

Symbol Refactoring is Broken #94

Closed

Description

From Brian Ojeda (@sgtoj) on March 15, 2017 14:52

Environment data

VS Code version: 1.10.2 (and latest Insiders)
Python Extension version: 0.6.0
Python Version: 3.6.0
OS and version: Windows 10

Actual behavior

Symbol renaming will fail or rename symbol before the intended to be edited. This issue only occurs if End of Line Sequence is set to CRLF.

Expected behavior

Rename the intended symbol correct with LF and CRLF line endings.

Steps to reproduce:

Try renaming a symbol in the following file...

# -*- coding: utf-8 -*-
"""Bug Workspace"""

class Test():
    """Test Class"""

    def __init__(self):
        self._name = 'FooBar'
        self._modt = 'Hello World!'
        self._isbug = True

    @property
    def name(self) -> str:
        """Name"""
        return self._name

    @property
    def modt(self) -> str:
        """Message of the Day"""
        return self._name

    @property
    def isbug(self) -> bool:
        """Is Bug"""
        return self._isbug

    def do_something(self) -> str:
        """Do Something"""
        return 'Something is not right here.'


def main():
    """Script Entry"""
    test = Test()
    print(test.name)
    print(test.modt)
    print(test.isbug)


if __name__ == '__main__':
    main()

Workspace Settings

{
    "python.linting.pylintEnabled": true,
    "python.formatting.provider": "yapf"
}

User Settings

{
    "python.workspaceSymbols.enabled": true,
    "python.workspaceSymbols.ctagsPath": "C:\\ctags\\ctags",
    "python.workspaceSymbols.tagFilePath": "${workspaceRoot}\\.vscode\\tags",
}

Copied from original issue: DonJayamanne/pythonVSCode#824

Activity

  1. DonJayamanne commented on Nov 13, 2017

    @DonJayamanne
    Author

    From Ashwin Mathews (@ajmathews) on March 18, 2017 0:58

    Appears to be similar to the problem I had
    #802

  2. DonJayamanne commented on Nov 13, 2017

    @DonJayamanne
    Author

    From Deleted user (@ghost) on August 10, 2017 6:44

    Any fix for this? It has been reported several times #875 #885 #902 #986 #991 #1081
    For me the rename never works so I always have to do it with select/replace.

    Thanks for looking into this!

  3. TopherGopher commented on Nov 29, 2017

    @TopherGopher

    +1 on this -
    I see the debug message at the top saying Rename failed, but the error text is cut-off. If you could let me know where to get the full output, I'd be happy to provide.

  4. brettcannon commented on Dec 20, 2017

    @brettcannon
    Member

    I just did a renaming of the following code with CLRF line endings and it worked for any position of the E variable:

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

    Now there is also #52 where renaming appears to be flaky, so it's also possible you have bumped into that. So I'm going to close this as a duplicate of that other issue.

  5. locked as resolved and limited conversation to collaborators on Jul 12, 2018
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