Skip to content

Commit

Permalink
Bugfix/default launch config values inconsistantly set (#616)
Browse files Browse the repository at this point in the history
  • Loading branch information
TwitchBronBron authored Feb 11, 2025
2 parents f576c5e + 2bc0ae8 commit 7009ae3
Showing 1 changed file with 12 additions and 35 deletions.
47 changes: 12 additions & 35 deletions src/DebugConfigurationProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ export class BrightScriptDebugConfigurationProvider implements DebugConfiguratio
retainStagingFolder: false,
enableVariablesPanel: true,
autoResolveVirtualVariables: false,
enhanceREPLCompletions: true,
enhanceREPLCompletions: false,
showHiddenVariables: false,
enableDebuggerAutoRecovery: false,
stopDebuggerOnAppExit: false,
Expand All @@ -70,6 +70,7 @@ export class BrightScriptDebugConfigurationProvider implements DebugConfiguratio
rendezvousTracking: true,
deleteDevChannelBeforeInstall: false,
sceneGraphDebugCommandsPort: 8080,
componentLibrariesPort: 8080,
remoteControlMode: {
activateOnSessionStart: false,
deactivateOnSessionEnd: false
Expand Down Expand Up @@ -206,6 +207,8 @@ export class BrightScriptDebugConfigurationProvider implements DebugConfiguratio
config = { ...bsconfig, ...config };
}

config.cwd = folderUri.fsPath;

config.rootDir = this.util.ensureTrailingSlash(config.rootDir ? config.rootDir : '${workspaceFolder}');

//Check for depreciated Items
Expand Down Expand Up @@ -237,44 +240,18 @@ export class BrightScriptDebugConfigurationProvider implements DebugConfiguratio
//create an empty array so it's easier to reason with downstream
config.componentLibraries = [];
}
config.componentLibrariesPort = config.componentLibrariesPort ? config.componentLibrariesPort : 8080;

// Apply any defaults to missing values
for (const key in this.configDefaults) {
config[key] ??= this.configDefaults[key];
}

// Run any required post processing after applying defaults
config.outDir = this.util.ensureTrailingSlash(config.outDir);

// Pass along files needed by RDB to roku-debug
config.rdbFilesBasePath = rta.utils.getDeviceFilesPath();

// Apply any defaults to missing values
config.type = config.type ? config.type : this.configDefaults.type;
config.name = config.name ? config.name : this.configDefaults.name;
config.host = config.host ? config.host : this.configDefaults.host;
config.password = config.password ? config.password : this.configDefaults.password;
config.consoleOutput = config.consoleOutput ? config.consoleOutput : this.configDefaults.consoleOutput;
config.autoRunSgDebugCommands = config.autoRunSgDebugCommands ? config.autoRunSgDebugCommands : this.configDefaults.autoRunSgDebugCommands;
config.request = config.request ? config.request : this.configDefaults.request;
config.stopOnEntry ??= this.configDefaults.stopOnEntry;
config.outDir = this.util.ensureTrailingSlash(config.outDir ? config.outDir : this.configDefaults.outDir);
config.retainDeploymentArchive = config.retainDeploymentArchive === false ? false : this.configDefaults.retainDeploymentArchive;
config.injectRaleTrackerTask = config.injectRaleTrackerTask === true ? true : this.configDefaults.injectRaleTrackerTask;
config.injectRdbOnDeviceComponent = config.injectRdbOnDeviceComponent === true ? true : this.configDefaults.injectRdbOnDeviceComponent;
config.disableScreenSaver = config.disableScreenSaver === false ? false : this.configDefaults.disableScreenSaver;
config.retainStagingFolder ??= this.configDefaults.retainStagingFolder;
config.enableVariablesPanel = 'enableVariablesPanel' in config ? config.enableVariablesPanel : this.configDefaults.enableVariablesPanel;
config.autoResolveVirtualVariables = config.autoResolveVirtualVariables === true ? true : this.configDefaults.autoResolveVirtualVariables;
config.enhanceREPLCompletions = config.enhanceREPLCompletions === true ? true : this.configDefaults.enhanceREPLCompletions;
config.showHiddenVariables = config.showHiddenVariables === true ? true : this.configDefaults.showHiddenVariables;
config.enableDebuggerAutoRecovery = config.enableDebuggerAutoRecovery === true ? true : this.configDefaults.enableDebuggerAutoRecovery;
config.stopDebuggerOnAppExit = config.stopDebuggerOnAppExit === true ? true : this.configDefaults.stopDebuggerOnAppExit;
config.files = config.files ? config.files : this.configDefaults.files;
config.enableSourceMaps = config.enableSourceMaps === false ? false : this.configDefaults.enableSourceMaps;
config.rewriteDevicePathsInLogs = config.rewriteDevicePathsInLogs === false ? false : this.configDefaults.rewriteDevicePathsInLogs;
config.packagePort = config.packagePort ? config.packagePort : this.configDefaults.packagePort;
config.remotePort = config.remotePort ? config.remotePort : this.configDefaults.remotePort;
config.logfilePath ??= null;
config.cwd = folderUri.fsPath;
config.rendezvousTracking = config.rendezvousTracking === false ? false : true;
config.deleteDevChannelBeforeInstall = config.deleteDevChannelBeforeInstall === true;
config.sceneGraphDebugCommandsPort = config.sceneGraphDebugCommandsPort ? config.sceneGraphDebugCommandsPort : this.configDefaults.sceneGraphDebugCommandsPort;
config.enableDebugProtocol ??= this.configDefaults.enableDebugProtocol;

//if packageTask is defined, make sure there's actually a task with that name defined
if (config.packageTask) {
const targetTask = (await vscode.tasks.fetchTasks()).find(x => x.name === config.packageTask);
Expand Down

0 comments on commit 7009ae3

Please sign in to comment.