Add trailing line number to filename for ConciseView (#11391)
This commit is contained in:
parent
384a7ba2d7
commit
563b1cba83
|
@ -1058,7 +1058,13 @@ namespace System.Management.Automation.Runspaces
|
|||
$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}""
|
||||
|
|
|
@ -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 *'
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue