@@ -15,6 +15,7 @@ import Settings = require("../settings");
15
15
import { Logger } from "../logging" ;
16
16
import { LanguageClientConsumer } from "../languageClientConsumer" ;
17
17
import path = require( "path" ) ;
18
+ import utils = require( "../utils" ) ;
18
19
19
20
export const StartDebuggerNotificationType =
20
21
new NotificationType < void > ( "powerShell/startDebugger" ) ;
@@ -244,17 +245,21 @@ export class DebugSessionFeature extends LanguageClientConsumer
244
245
}
245
246
246
247
// Check the temporary console setting for untitled documents only, and
247
- // check the document extension for everything else.
248
+ // check the document extension for if the script is an extant file (it
249
+ // could be inline).
248
250
if ( config . untitled_document ) {
249
251
if ( config . createTemporaryIntegratedConsole ) {
250
252
await vscode . window . showErrorMessage ( "Debugging untitled files in a temporary console is not supported." ) ;
251
253
return undefined ;
252
254
}
253
255
} else if ( config . script ) {
254
- const ext = path . extname ( config . script ) . toLowerCase ( ) ;
255
- if ( ! ( ext === ".ps1" || ext === ".psm1" ) ) {
256
- await vscode . window . showErrorMessage ( `PowerShell does not support debugging this file type: '${ path . basename ( config . script ) } '` ) ;
257
- return undefined ;
256
+ // TODO: Why even bother with this complexity?
257
+ if ( await utils . checkIfFileExists ( config . script ) ) {
258
+ const ext = path . extname ( config . script ) . toLowerCase ( ) ;
259
+ if ( ! ( ext === ".ps1" || ext === ".psm1" ) ) {
260
+ await vscode . window . showErrorMessage ( `PowerShell does not support debugging this file type: '${ path . basename ( config . script ) } '` ) ;
261
+ return undefined ;
262
+ }
258
263
}
259
264
}
260
265
0 commit comments