-
Notifications
You must be signed in to change notification settings - Fork 395
Auto Format corrupting paths in my scripts #1206
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Comments
@ili101 thanks for reporting this, do you use any code formatting settings? |
@SydneyhSmith No. Also tested now on a clean system, same problem. |
I can repro this with the default code formatting settings. I can't repro this with PSSA 1.18 from the command line when I supply no settings. I "suspect" it is one of the PSSA settings that is causing this issue since formatting is done by PSSA. |
I can repro this outside of PSES so I do think it is a PSSA bug: |
It is most likely a PSSA issue, I have seen something similar before but it was a very convoluted case that was hard to repro/debug. This looks much better, I'll see if I can repro and then we should move it to the PSSA repo. |
Note that while I was able to repro in pwsh running in VSCode, I wasn't able to repro in a stand-alone pwsh.exe. That is a bit on the "weird" side. |
@SydneyhSmith could you move this issue to the ScriptAnalyzer repo? |
FYI Same problem reported with UNC paths:
How did I do that? 😆 |
It's a bummer to have to turn off and not use the PS Formatter b/c of this. The truncation of paths occurs with any formatting operation including formatting selected text. |
I just downgraded to VSCode PowerShell 1.11.0 |
I don't see it mentioned anywhere, but this is caused by the setting for 'Use Correct Casing for Cmdlets'. While correcting the casing, it changes the extension, removes the path, etc... |
So, what is the status of this bug? Is there any expectation for the fix? |
Is there someone from the development team monitoring the Issues here or is this module is kind of Abandonware? |
I have not had the time to repro yet but I think PR #1216 and/or PR #1210 that are already merged into the |
@bergmeister I updated to the last VSCode PowerShell v2019.5.0 |
Sorry, I cannot repro this, can you please add more details about which formatting settings you use @ili101 or @rkeithhill ?Does the current working directory play a role, etc? |
I'm still able to repro:
Here is my setting file: |
I cannot seem to reproduce this. but I do get the annoying change of I am pretty sure this is coming from the setting 'usecorrectcasing', but this is changing more than casing. |
@bergmeister @msftrncs Regarding the reproduce problem, I did some more testing:
|
OK, I can repro now but only if I open PowerShell using the explorer context menu (which uses the Just to repeat again: We have disabled the newly added vs code setting |
Issue Type: Bug

& ..\Desktop\Temp\Test.ps1
(The file need to exist).This is a major issue as opening a big script, changing a line (That triggers the auto format) will result in all paths in the document to corrupt braking the script! And if you saved and don't have a backup you are in trouble.
Extension version: 1.12.0
VS Code version: Code 1.32.3 (a3db5be9b5c6ba46bb7555ec5d60178ecc2eaae4, 2019-03-14T23:43:35.476Z)
OS version: Windows_NT x64 10.0.17763
EditorServices.log
vscode-powershell.log
System Info
checker_imaging: disabled_off
flash_3d: enabled
flash_stage3d: enabled
flash_stage3d_baseline: enabled
gpu_compositing: enabled
multiple_raster_threads: enabled_on
native_gpu_memory_buffers: disabled_software
rasterization: enabled
surface_synchronization: enabled_on
video_decode: enabled
webgl: enabled
webgl2: enabled
The text was updated successfully, but these errors were encountered: