Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BUG: Formatting replaces double colon :: with a single one : #1619

Closed
rdhar opened this issue Dec 11, 2020 · 6 comments
Closed

BUG: Formatting replaces double colon :: with a single one : #1619

rdhar opened this issue Dec 11, 2020 · 6 comments

Comments

@rdhar
Copy link

rdhar commented Dec 11, 2020

Steps to reproduce

Input the following snippet and observe as the formatting replaces the double colon :: with a single one :.

Invoke-WebRequest-Body "eai:data=$([uri]::EscapeDataString($source.InnerXml))"

Expected behavior

There should be no change.

Actual behavior

After formatting, the double colon :: is replaced with a single one :, thereby breaking the code.

Environment data

Toggling each one, it appears to be down to "powershell.codeFormatting.whitespaceBetweenParameters": true, rule which causes the issue with VS Code's PowerShell 2020.6.0 extension.

Doesn't seem to be replicable in VS Code's PowerShell Preview 2020.9.0, even with the aforementioned rule enabled.

Major  Minor  Patch  PreReleaseLabel BuildLabel
-----  -----  -----  --------------- ----------
7      1      0

Thanks for your time.

@ghost ghost added the Needs: Triage 🔍 label Dec 11, 2020
@ninmonkey
Copy link

Does the code in #1541 break with this setting on?

@rjmholt
Copy link
Contributor

rjmholt commented Dec 11, 2020

Looks to be a duplicate of #1561

@rjmholt
Copy link
Contributor

rjmholt commented Dec 11, 2020

@rdhar it would also be helpful if you could provide the information requested in the issue template:


Environment data
----------------

<!-- Provide the output of the following 2 commands -->

> $PSVersionTable

> (Get-Module -ListAvailable PSScriptAnalyzer).Version | ForEach-Object { $_.ToString() }

@ghost
Copy link

ghost commented Dec 12, 2020

This issue has been marked as duplicate and has not had any activity for 1 day. It will be closed for housekeeping purposes.

@ghost ghost closed this as completed Dec 12, 2020
@rdhar
Copy link
Author

rdhar commented Dec 14, 2020

Apologies for the delay; here's the update as requested.

Environment Data
>  $PSVersionTable
Name                           Value
----                           -----
PSVersion                      7.1.0
PSEdition                      Core
GitCommitId                    7.1.0
OS                             Microsoft Windows 10.0.19042
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

> (Get-Module -ListAvailable PSScriptAnalyzer).Version | ForEach-Object { $_.ToString() }
1.19.1

That's right, @ninmonkey, the code only breaks with powershell.codeFormatting.whitespaceBetweenParameters enabled, as per #1541.


I've added another example scenario which demonstrates the issue; replacing :: with just a single :. Do let me know if this is still a duplicate, @rjmholt.

Note, it only impacts PowerShell v2020.6.0 extension, as opposed to PowerShell Preview v2020.9.0. Given the issue cannot be replicated in the latest Preview, I'm not fussed about a resolution in the stable version.

# Input
Invoke-WebRequest … -Body "eai:data=$([uri]::EscapeDataString($source.InnerXml))"
Write-Host "eai:data=$([uri]::EscapeDataString('123++'))"

# Actual behaviour
Invoke-WebRequest … -Body "eai:data=$([uri]:EscapeDataString($source.InnerXml))"
Write-Host "eai:data=$([uri]:EscapeDataString('123++'))"

@bergmeister
Copy link
Collaborator

This is a bug that got fixed in pssa 1.19.1, hence why it does not occur in the stable extension, which has not had been updated for a looong time...

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants