File tree Expand file tree Collapse file tree 1 file changed +23
-3
lines changed
src/PowerShellEditorServices.Protocol/Server Expand file tree Collapse file tree 1 file changed +23
-3
lines changed Original file line number Diff line number Diff line change @@ -102,9 +102,29 @@ protected Task LaunchScript(RequestContext<object> requestContext)
102102 // Ensure the read loop is stopped
103103 this . editorSession . ConsoleService . CancelReadLoop ( ) ;
104104
105- return editorSession . PowerShellContext
106- . ExecuteScriptWithArgs ( this . scriptToLaunch , this . arguments , writeInputToHost : true )
107- . ContinueWith ( this . OnExecutionCompleted ) ;
105+ // Is this an untitled script?
106+ Task launchTask = null ;
107+
108+ if ( this . scriptToLaunch . StartsWith ( "untitled" ) )
109+ {
110+ ScriptFile untitledScript =
111+ this . editorSession . Workspace . GetFile (
112+ this . scriptToLaunch ) ;
113+
114+ launchTask =
115+ this . editorSession
116+ . PowerShellContext
117+ . ExecuteScriptString ( untitledScript . Contents , true , true ) ;
118+ }
119+ else
120+ {
121+ launchTask =
122+ this . editorSession
123+ . PowerShellContext
124+ . ExecuteScriptWithArgs ( this . scriptToLaunch , this . arguments , writeInputToHost : true ) ;
125+ }
126+
127+ return launchTask . ContinueWith ( this . OnExecutionCompleted ) ;
108128 }
109129
110130 private async Task OnExecutionCompleted ( Task executeTask )
You can’t perform that action at this time.
0 commit comments