From c9feb129aa3667b8e89ba60423265c645bc95522 Mon Sep 17 00:00:00 2001
From: Rob Lourens <roblourens@gmail.com>
Date: Mon, 12 Nov 2018 19:43:39 -0800
Subject: [PATCH] Attempt workaround for Microsoft/vscode#60187

---
 package.json                 | 10 ++++++++++
 src/nodeDebugAdapter.ts      |  2 +-
 src/nodeDebugInterfaces.d.ts |  3 +++
 3 files changed, 14 insertions(+), 1 deletion(-)

diff --git a/package.json b/package.json
index 806f2721..e8ddeae0 100644
--- a/package.json
+++ b/package.json
@@ -366,6 +366,11 @@
                 "type": "boolean",
                 "description": "%node.enableSourceMapCaching.description%",
                 "default": true
+              },
+              "_disableOptimisticBPs": {
+                "type": "boolean",
+                "description": "Don't set breakpoints in any file until a sourcemap has been loaded for that file.",
+                "default": true
               }
             }
           },
@@ -481,6 +486,11 @@
                 "type": "boolean",
                 "description": "%node.enableSourceMapCaching.description%",
                 "default": true
+              },
+              "_disableOptimisticBPs": {
+              	"type": "boolean",
+              	"description": "Don't set breakpoints in any file until a sourcemap has been loaded for that file.",
+              	"default": true
               }
             }
           }
diff --git a/src/nodeDebugAdapter.ts b/src/nodeDebugAdapter.ts
index c742797c..354e6b13 100644
--- a/src/nodeDebugAdapter.ts
+++ b/src/nodeDebugAdapter.ts
@@ -705,7 +705,7 @@ export class NodeDebugAdapter extends ChromeDebugAdapter {
 
     protected validateBreakpointsPath(args: ISetBreakpointsArgs): Promise<void> {
         return super.validateBreakpointsPath(args).catch(e => {
-            if (args.source.path && utils.isJavaScript(args.source.path)) {
+            if (!this._launchAttachArgs._disableOptimisticBPs && args.source.path && utils.isJavaScript(args.source.path)) {
                 return undefined;
             } else {
                 return Promise.reject(e);
diff --git a/src/nodeDebugInterfaces.d.ts b/src/nodeDebugInterfaces.d.ts
index 9562fcee..98b4272d 100644
--- a/src/nodeDebugInterfaces.d.ts
+++ b/src/nodeDebugInterfaces.d.ts
@@ -17,6 +17,9 @@ export interface ICommonRequestArgs extends Core.ICommonRequestArgs {
     cwd?: string;
     /** Request frontend to restart session on termination. */
     restart?: boolean;
+
+    /** Don't set breakpoints in JS files that don't have sourcemaps */
+    _disableOptimisticBPs?: boolean;
 }
 
 /**