ironmansoftware / powershell-pro-tools

Scripting, automation, and development tools for professionals working with PowerShell.
MIT License
60 stars 3 forks source link

Refactoring in VS Code does not work on new (unsaved) documents #2

Closed geertvanzoest closed 2 months ago

geertvanzoest commented 1 year ago

Describe the bug The Refactoring feature of PowerShell Pro Tools in VS Code does not behave as expected, when trying to apply a suggestion in a yet-to-be-saved PS1-document. The context menu with refactor suggestions does appear by clicking on the lightbulb icon, but clicking on a suggestion does not change the selected element.

To Reproduce Steps to reproduce the behavior:

  1. Open a new file (Ctrl+N)
  2. Set the editor's Language Mode to 'PowerShell'
  3. Type '$_'
  4. Click on the light bulb icon -> 'Convert to $PSItem'
  5. See unexpected behaviour: nothing happens
  6. Now save the document (Ctrl+S) as a PS1-document
  7. Try 'Concert to $PSItem' again
  8. See expected behaviour: the element gets refactored

Expected behavior My expectation is that either the element also gets refactored in unsaved documents, or that the refactor functionality is not available.

Screenshots When saving the new document as a PS1-file, refactoring does work:

image

Version VS Code: 1.80.1 (user setup) Version Number: PowerShell Pro Tools v2023.9.0 Operating System: Windows 10 Enterprise 22H2

Additional context The Output window inside VS Code does not show an error of PowerShell Pro Tools or anything.

Logs I cannot find PPT logfiles. There is no directory $Env:AppData\PowerShellProTools. There is directory $Env:AppData\PowerShell Pro Tools\ but only a license file is inside.