Skip to content

Commit ffd0ef7

Browse files
Fix New-EditorFile with no folder or no files open (#906)
* Fix New-EditorFile with no folder or no files open * address rob's feedback
1 parent bfb4e8e commit ffd0ef7

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

module/PowerShellEditorServices/Commands/Public/CmdletInterface.ps1

+5
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,11 @@ function New-EditorFile {
136136
$preview = $true
137137
}
138138

139+
# Resolve full path before passing to editor
140+
if (!([System.IO.Path]::IsPathRooted($fileName))) {
141+
$fileName = $ExecutionContext.SessionState.Path.GetUnresolvedProviderPathFromPSPath($fileName)
142+
}
143+
139144
$psEditor.Workspace.OpenFile($fileName, $preview)
140145
$psEditor.GetEditorContext().CurrentFile.InsertText(($valueList | Out-String))
141146
} else {

0 commit comments

Comments
 (0)