Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix bug with compile error reporting #174

Merged
merged 1 commit into from
Nov 16, 2023
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: 0 additions & 4 deletions src/adapters/DebugProtocolAdapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -340,10 +340,6 @@ export class DebugProtocolAdapter {

public async watchCompileOutput() {
let deferred = defer();
//If the debugProtocol supports compile error updates, don't scrape telnet logs for compile errors
if (this.supportsCompileErrorReporting) {
return deferred.resolve();
}
try {
this.compileClient = new Socket();
this.compileErrorProcessor.on('diagnostics', (errors) => {
Expand Down
42 changes: 3 additions & 39 deletions src/debugSession/BrightScriptDebugSession.ts
Original file line number Diff line number Diff line change
Expand Up @@ -215,43 +215,6 @@ export class BrightScriptDebugSession extends BaseDebugSession {
return this.launchConfiguration?.cwd ?? process.cwd();
}

public async fetchDeviceInfo(host: string, remotePort: number) {

this.logger.info('Fetching Roku Device Info');
const url = `http://${host}:${remotePort}/query/device-info`;
try {
// concatenates the url string using template literals
const ressponse = await util.httpGet(url);
const xml = ressponse.body;

// parses the xml data to JSON object
const result = (await xml2js.parseStringPromise(xml))['device-info'];

// converts any true or false string values to boolean
for (let key in result) {
result[key] = result[key][0];
if (result[key] === 'true') {
result[key] = true;
} else if (result[key] === 'false') {
result[key] = false;
}
}

result.host = this.launchConfiguration.host;
result.remotePort = this.launchConfiguration.remotePort;

// parses string value to int for the following fields
result['software-build'] = parseInt(result['software-build'] as string);
result.uptime = parseInt(result.uptime as string);
result['trc-version'] = parseInt(result['trc-version'] as string);
result['av-sync-calibration-enabled'] = parseInt(result['av-sync-calibration-enabled'] as string);
result['time-zone-offset'] = parseInt(result['time-zone-offset'] as string);
return result;
} catch (e) {
throw new Error(`Unable to fetch device-info from '${url}'`);
}
}

public deviceInfo: DeviceInfo;

public async launchRequest(response: DebugProtocol.LaunchResponse, config: LaunchConfiguration) {
Expand Down Expand Up @@ -770,15 +733,16 @@ export class BrightScriptDebugSession extends BaseDebugSession {

protected async threadsRequest(response: DebugProtocol.ThreadsResponse) {
this.logger.log('threadsRequest');
//wait for the roku adapter to load
await this.getRokuAdapter();

let threads = [];

//This is a bit of a hack. If there's a compile error, send a thread to represent it so we can show the compile error like a runtime exception
if (this.compileError) {
threads.push(new Thread(this.COMPILE_ERROR_THREAD_ID, 'Compile Error'));
} else {
//wait for the roku adapter to load
await this.getRokuAdapter();

//only send the threads request if we are at the debugger prompt
if (this.rokuAdapter.isAtDebuggerPrompt) {
let rokuThreads = await this.rokuAdapter.getThreads();
Expand Down
Loading