locked
Rename Not Working in Blazor Code RRS feed

  • Question

  • I have just started writing a Blazor WebAssembly app using Visual Studio Community 2019 V 16.6.0 on a Windows 10 laptop.  When in a Blazor component, I am not seeing the Rename refactoring option when I right click a variable or method name.  The Find All References action is there, indicating VS is aware of what would need to be renamed.  Rename does work in my JavaScript code in the same project.  Am I missing something?

    Thanks.  Steve

    Monday, June 1, 2020 1:36 PM

Answers

  • Hi Steve,

    Thanks for sharing me with details and screenshots.

    I can reproduce your issue on my side, and I consider this is a potential issue. I have reported this issue to VS Product Team, and this is the link, you could go to vote, add comments and follow that thread.

    BTW, as an alternative way, you could try to use the shortcut keys(focus on the method/variable, and press Ctrl + R then press Ctrl + R again) to rename/refactor the variable or method name currently.

    Hope this helps.

    Kind Regards,

    Tianyu


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    • Marked as answer by Cincy Steve Wednesday, June 3, 2020 12:56 PM
    Wednesday, June 3, 2020 2:12 AM

All replies

  • Hi Steve,

    Welcome to MSDN forum.

    Could you share me with more detailed information(screenshots) and reproduced steps? I may misunderstand you, but do you mean you’d like to rename the variable or method’s name which are customized or you mean rename those which are defined from system?

    >> Am I missing something?

    ## I checked the official documents and there aren’t any information about renaming or refactoring, so I think you don’t miss something and this may be by design.

    Feel free to contact me.

    Best Regards,

    Tianyu


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Tuesday, June 2, 2020 2:35 AM
  • Tianyu -

    Thanks for your reply.  In answer to your question, I am trying to change the name of variables and methods in my code, not those that are defined from system.  I am attaching 2 screenshots:

    1. Shows a right click on a method name in my TypeScript code.  I did Find All References first so that you can see that VS finds references to the method.  And the right click popup does contain the Rename action as I would expect.

    2. Shows a right click on a variable in my Blazor code.  Once again I did Find All References first so that you can see that VS finds several references to the variable.  But the right click popup does NOT contain the Rename action in the Blazor code.

    I hope the answer is not that this is not supported as you suggest.  Please let me know if this clarifies the problem I am seeing.

    Thanks.  Steve

    Tuesday, June 2, 2020 1:14 PM
  • Hi Steve,

    Thanks for sharing me with details and screenshots.

    I can reproduce your issue on my side, and I consider this is a potential issue. I have reported this issue to VS Product Team, and this is the link, you could go to vote, add comments and follow that thread.

    BTW, as an alternative way, you could try to use the shortcut keys(focus on the method/variable, and press Ctrl + R then press Ctrl + R again) to rename/refactor the variable or method name currently.

    Hope this helps.

    Kind Regards,

    Tianyu


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    • Marked as answer by Cincy Steve Wednesday, June 3, 2020 12:56 PM
    Wednesday, June 3, 2020 2:12 AM
  • Tianyu - 

    Thanks for submitting the problem to the VS Product Team and for providing the workaround until it is fixed.  Just what I needed.

    Steve

    Wednesday, June 3, 2020 12:56 PM
  • Hi Steve,

    You are welcome, if you have any other questions about Visual Studio General in the future, feel free to contact us.

    Have a nice day :)

    Sincerely,

    Tianyu


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.


    Thursday, June 4, 2020 2:08 AM