Skip to content

Commit 29edd9b

Browse files
committed
settings: adding autoStartBrowserURL setting to customize the URL that is opened when the browser starts
1 parent 537b70d commit 29edd9b

File tree

4 files changed

+16
-1
lines changed

4 files changed

+16
-1
lines changed

package.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -373,6 +373,10 @@
373373
"description": "Open external browser to launch the application",
374374
"type": "boolean"
375375
},
376+
"autoStartBrowserURL": {
377+
"description": "The URL to open in the external browser if autoStartBrowser is true. The URL can be a regular expression that matches the URL to open in the stdout.",
378+
"type": "string"
379+
},
376380
"django": {
377381
"default": false,
378382
"description": "Django debugging.",

src/extension/debugger/configuration/resolvers/base.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -254,6 +254,7 @@ export abstract class BaseConfigurationResolver<T extends DebugConfiguration>
254254
showReturnValue: !!debugConfiguration.showReturnValue,
255255
subProcess: !!debugConfiguration.subProcess,
256256
autoStartBrowser: !!debugConfiguration,
257+
autoStartBrowserURL: debugConfiguration.autoStartBrowserURL,
257258
watson: name.toLowerCase().indexOf('watson') >= 0,
258259
pyspark: name.toLowerCase().indexOf('pyspark') >= 0,
259260
gevent: name.toLowerCase().indexOf('gevent') >= 0,

src/extension/debugger/configuration/resolvers/launch.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,8 +147,12 @@ export class LaunchConfigurationResolver extends BaseConfigurationResolver<Launc
147147
const isFastAPI = LaunchConfigurationResolver.isDebuggingFastAPI(debugConfiguration);
148148
const isFlask = LaunchConfigurationResolver.isDebuggingFlask(debugConfiguration);
149149
if (debugConfiguration.autoStartBrowser && (debugConfiguration.django || isFlask)) {
150+
let pattern = '.*(?:(http|https):\\/\\/\\S+:[0-9]+\\/?).*';
151+
if (debugConfiguration.autoStartBrowserURL !== undefined) {
152+
pattern = `.*(${debugConfiguration.autoStartBrowserURL}).*`;
153+
}
150154
debugConfiguration.serverReadyAction = {
151-
pattern: '.*(https?:\\/\\/\\S+:[0-9]+\\/?).*',
155+
pattern: pattern,
152156
uriFormat: '%s',
153157
action: 'openExternally',
154158
};

src/extension/telemetry/index.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -564,6 +564,12 @@ export interface IEventNamePropertyMapping {
564564
* @type {boolean}
565565
*/
566566
autoStartBrowser: boolean;
567+
/**
568+
* A custom URL to start in the browser when autoStartBrowser is true.
569+
*
570+
* @type {string}
571+
*/
572+
autoStartBrowserURL: string;
567573
};
568574
/**
569575
* Telemetry event sent when attaching to child process

0 commit comments

Comments
 (0)