Skip to content

Clear-Host causes cursor position state issues with PSReadLine #2408

Closed
PowerShell/PowerShellEditorServices
#1162
@ghost

Description

System Details

System Details Output

### VSCode version: 1.41.1 26076a4de974ead31f97692a0d32f90d735645c0 x64

### VSCode extensions:
ms-vscode.powershell-preview@2019.12.0


### PSES version: 2.0.0.0

### PowerShell version:

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

Issue Description

Trying to get the directory of the current script using Split-Path -Path $PSScriptRoot -Parent.

Expected Behaviour

image
Running the same script in ISE gives the expected result.

Actual Behaviour

image

As you can see, in VSCode, the result is not the parent. It's returned the whole file.

I have tried other variations such as

$RootPath = Split-Path (Split-Path $PSScriptRoot -Parent) -Parent
$RootPath

# or

(Get-ChildItem -Path $PSScriptRoot).Parent

It always returns the full path.

Attached Logs

Follow the instructions in the troubleshooting docs
about capturing and sending logs.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions