Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/FileUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ export class FileUtils {
* force all drive letters to lower case (because that's what VSCode does sometimes so this makes it consistent)
* @param thePath
*/
public standardizePath(thePath: string) {
public standardizePath(thePath: string): string {
if (!thePath) {
return thePath;
}
Expand Down Expand Up @@ -330,7 +330,7 @@ export let fileUtils = new FileUtils();
/**
* A tagged template literal function for standardizing the path.
*/
export function standardizePath(stringParts, ...expressions: any[]) {
export function standardizePath(stringParts, ...expressions: any[]): string {
let result = [];
for (let i = 0; i < stringParts.length; i++) {
result.push(stringParts[i], expressions[i]);
Expand Down
3 changes: 3 additions & 0 deletions src/debugSession/BrightScriptDebugSession.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,9 @@ describe('BrightScriptDebugSession', () => {
} catch (e) {
console.log(e);
}
//always resolve the stagingDefered promise right away since most tests don't care about staging and this prevents a lot of unnecessary waiting
session['stagingDefered'].resolve();

errorSpy = sinon.spy(session.logger, 'error');
//override the error response function and throw an exception so we can fail any tests
(session as any).sendErrorResponse = (...args: string[]) => {
Expand Down
15 changes: 15 additions & 0 deletions src/debugSession/BrightScriptDebugSession.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ export class BrightScriptDebugSession extends LoggingDebugSession {

//give util a reference to this session to assist in logging across the entire module
util._debugSession = this;

this.fileManager = new FileManager();
this.sourceMapManager = new SourceMapManager();
this.locationManager = new LocationManager(this.sourceMapManager);
Expand Down Expand Up @@ -291,6 +292,11 @@ export class BrightScriptDebugSession extends LoggingDebugSession {
*/
private firstRunDeferred = defer<void>();

/**
* Resolved whenever we're finished copying all the files to staging for all projects
*/
private stagingDefered = defer<void>();

private evaluateRefIdLookup: Record<string, number> = {};
private evaluateRefIdCounter = 1;

Expand Down Expand Up @@ -608,6 +614,10 @@ export class BrightScriptDebugSession extends LoggingDebugSession {
this.prepareMainProject(),
this.prepareAndHostComponentLibraries(this.launchConfiguration.componentLibraries, this.launchConfiguration.componentLibrariesPort)
]);

//all of the projects have been successfully staged.
this.stagingDefered.tryResolve();

packageEnd();

if (this.enableDebugProtocol) {
Expand Down Expand Up @@ -1423,6 +1433,9 @@ export class BrightScriptDebugSession extends LoggingDebugSession {
};
this.sendResponse(response);

//ensure we've staged all the files
await this.stagingDefered.promise;

await this.rokuAdapter?.syncBreakpoints();
}

Expand Down Expand Up @@ -2483,6 +2496,8 @@ export class BrightScriptDebugSession extends LoggingDebugSession {
await this.rokuAdapter.destroy();
await this.ensureAppIsInactive();
this.rokuAdapterDeferred = defer();
this.stagingDefered.tryResolve();
this.stagingDefered = defer();
}
await this.launchRequest(response, args.arguments as LaunchConfiguration);
}
Expand Down
Loading