@@ -15,6 +15,7 @@ import Settings = require("../settings");
1515import { Logger } from "../logging" ;
1616import { LanguageClientConsumer } from "../languageClientConsumer" ;
1717import path = require( "path" ) ;
18+ import utils = require( "../utils" ) ;
1819
1920export const StartDebuggerNotificationType =
2021 new NotificationType < void > ( "powerShell/startDebugger" ) ;
@@ -244,17 +245,21 @@ export class DebugSessionFeature extends LanguageClientConsumer
244245 }
245246
246247 // 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).
248250 if ( config . untitled_document ) {
249251 if ( config . createTemporaryIntegratedConsole ) {
250252 await vscode . window . showErrorMessage ( "Debugging untitled files in a temporary console is not supported." ) ;
251253 return undefined ;
252254 }
253255 } 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+ }
258263 }
259264 }
260265
0 commit comments