Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1058,7 +1058,13 @@ function Get-ConciseViewPositionMessage {
$useTargetObject = $true
}
elseif ($myinv.ScriptName) {
$posmsg = ""${resetcolor}$($myinv.ScriptName)${newline}""
if ($env:TERM_PROGRAM -eq 'vscode') {
# If we are running in vscode, we know the file:line:col links are clickable so we use this format
$posmsg = ""${resetcolor}$($myinv.ScriptName):$($myinv.ScriptLineNumber):$($myinv.OffsetInLine)${newline}""
}
else {
$posmsg = ""${resetcolor}$($myinv.ScriptName):$($myinv.ScriptLineNumber)${newline}""
}
}
else {
$posmsg = ""${newline}""
Expand Down
2 changes: 1 addition & 1 deletion test/powershell/engine/Formatting/ErrorView.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ Describe 'Tests for $ErrorView' -Tag CI {
$testScriptPath = Join-Path -Path $TestDrive -ChildPath 'test.ps1'
Set-Content -Path $testScriptPath -Value $testScript
$e = { & $testScriptPath } | Should -Throw -ErrorId 'UnexpectedToken' -PassThru
$e | Out-String | Should -BeLike "*$testScriptPath*"
$e | Out-String | Should -BeLike "*${testScriptPath}:4*"
# validate line number is shown
$e | Out-String | Should -BeLike '* 4 *'
}
Expand Down