Vscode-powershell: Make file paths with spaces in the console work as clickable links

Created on 31 May 2019  路  9Comments  路  Source: PowerShell/vscode-powershell

System Details


System Details Output

### VSCode version: 1.34.0 a622c65b2c713c890fcf4fbf07cf34049d5fe758 x64

### VSCode extensions:
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]


### PSES version: 1.12.1.0

### PowerShell version:

Name                           Value
----                           -----
PSVersion                      5.1.18362.113
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.18362.113
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1

Issue Description

When something is broken, and an error is thrown VSCode allows you to ctrl+click link to link to file. This is great, but it doesn't work with the path that has spaces in them.

image

Expected Behaviour

Should work with paths with spaces.

Area-UI Issue-Enhancement vscode-feature

Most helpful comment

We should investigate how VSCode does this first -- it may be that quoting won't help

All 9 comments

I'm not sure this is something the extension controls. It is the VSCode terminal that turns paths into clickable links (not this extension). And the extension doesn't control the generation of that path and the fact that it isn't quoted. It is PowerShell that generates that error text.

Oops, had a comment written out but forgot to post and @rkeithhill's since commented!

@PrzemyslawKlys I'm not sure how we'd change this; these links appear because VSCode automatically turns paths into links (i.e. we don't do anything, it's a native VSCode feature).
The error message itself comes directly from PowerShell too.

If you get rid of the PowerShell extension and replicate the same error in the powershell or pwsh console, you'll see identical behaviour.

Without us intercepting and reformatting the error message in the integrated console (which I imagine might be unwanted by many users and would come at a performance and complexity cost), I'm not sure what we can do here

I figured it might not be something straight forward. If it can't be fixed I can close this issue. It's not a big deal, just something that would be useful in the long run. Maybe a fix to PS6/PS7 so that throwing errors would include path in quotes? Still, older versions of PS would have the problem, but at least new releases would work.

Maybe a fix to PS6/PS7 so that throwing errors would include path in quotes? Still, older versions of PS would have the problem, but at least new releases would work.

Good thinking!

We should investigate how VSCode does this first -- it may be that quoting won't help

@Tyriar any thoughts here?

Quoting doesn't seem to work. :-(

Quoting doesn't seem to work. :-(

Yeah I had a play around with it and I suspect the link support starts after the quote, where the C:\ or the / occurs

I was going to suggest maybe trying 8.3 naming convention... But... WindowsPowerShell is one of two directories in C:\Program Files that doesn't have 8.3 naming (the other being ModifiableWindowsApps) (also note Windows.old appears to be another one with no 8.3...)

image

Was this page helpful?
0 / 5 - 0 ratings

Related issues

borisimple picture borisimple  路  3Comments

nathan-alden-hp picture nathan-alden-hp  路  3Comments

GQnzo picture GQnzo  路  3Comments

TheDanishDynamo picture TheDanishDynamo  路  3Comments

daviwil picture daviwil  路  4Comments