roku-debug 0.23.11 → 0.23.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (28) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/dist/LaunchConfiguration.d.ts +17 -0
  3. package/dist/adapters/DebugProtocolAdapter.d.ts +3 -0
  4. package/dist/adapters/DebugProtocolAdapter.js +4 -1
  5. package/dist/adapters/DebugProtocolAdapter.js.map +1 -1
  6. package/dist/adapters/TelnetAdapter.d.ts +3 -0
  7. package/dist/adapters/TelnetAdapter.js.map +1 -1
  8. package/dist/debugProtocol/client/DebugProtocolClient.js +4 -1
  9. package/dist/debugProtocol/client/DebugProtocolClient.js.map +1 -1
  10. package/dist/debugProtocol/client/ProtocolCapabilities.d.ts +5 -0
  11. package/dist/debugProtocol/client/ProtocolCapabilities.js +7 -0
  12. package/dist/debugProtocol/client/ProtocolCapabilities.js.map +1 -1
  13. package/dist/debugProtocol/events/requests/ThreadsRequest.d.ts +9 -0
  14. package/dist/debugProtocol/events/requests/ThreadsRequest.js +24 -2
  15. package/dist/debugProtocol/events/requests/ThreadsRequest.js.map +1 -1
  16. package/dist/debugProtocol/events/responses/ThreadsResponse.d.ts +12 -0
  17. package/dist/debugProtocol/events/responses/ThreadsResponse.js +21 -4
  18. package/dist/debugProtocol/events/responses/ThreadsResponse.js.map +1 -1
  19. package/dist/debugSession/BrightScriptDebugSession.d.ts +7 -0
  20. package/dist/debugSession/BrightScriptDebugSession.js +59 -8
  21. package/dist/debugSession/BrightScriptDebugSession.js.map +1 -1
  22. package/dist/debugSession/Events.d.ts +4 -0
  23. package/dist/debugSession/Events.js +5 -1
  24. package/dist/debugSession/Events.js.map +1 -1
  25. package/dist/managers/ProjectManager.d.ts +20 -0
  26. package/dist/managers/ProjectManager.js +11 -0
  27. package/dist/managers/ProjectManager.js.map +1 -1
  28. package/package.json +3 -3
@@ -5,6 +5,7 @@ import type { ProtocolRequest } from '../ProtocolEvent';
5
5
  export declare class ThreadsRequest implements ProtocolRequest {
6
6
  static fromJson(data: {
7
7
  requestId: number;
8
+ includeIdentityInfo?: boolean;
8
9
  }): ThreadsRequest;
9
10
  static fromBuffer(buffer: Buffer): ThreadsRequest;
10
11
  toBuffer(): Buffer;
@@ -17,5 +18,13 @@ export declare class ThreadsRequest implements ProtocolRequest {
17
18
  packetLength: number;
18
19
  requestId: number;
19
20
  command: Command;
21
+ /**
22
+ * Indicates whether the THREADS response should include per-thread identity info
23
+ * (os thread id, name, and type). Only supported on protocol v3.3.0 and above.
24
+ */
25
+ includeIdentityInfo?: boolean;
20
26
  };
21
27
  }
28
+ export declare enum ThreadRequestFlags {
29
+ includeIdentityInfo = 1
30
+ }
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ThreadsRequest = void 0;
3
+ exports.ThreadRequestFlags = exports.ThreadsRequest = void 0;
4
+ /* eslint-disable no-bitwise */
4
5
  const smart_buffer_1 = require("smart-buffer");
5
6
  const Constants_1 = require("../../Constants");
6
7
  const ProtocolUtil_1 = require("../../ProtocolUtil");
@@ -12,29 +13,50 @@ class ThreadsRequest {
12
13
  */
13
14
  this.readOffset = undefined;
14
15
  this.data = {
15
- //common props
16
16
  packetLength: undefined,
17
17
  requestId: undefined,
18
18
  command: Constants_1.Command.Threads
19
19
  };
20
20
  }
21
21
  static fromJson(data) {
22
+ var _a;
23
+ var _b;
22
24
  const request = new ThreadsRequest();
23
25
  ProtocolUtil_1.protocolUtil.loadJson(request, data);
26
+ //default any missing value to false
27
+ (_a = (_b = request.data).includeIdentityInfo) !== null && _a !== void 0 ? _a : (_b.includeIdentityInfo = false);
24
28
  return request;
25
29
  }
26
30
  static fromBuffer(buffer) {
27
31
  const request = new ThreadsRequest();
28
32
  ProtocolUtil_1.protocolUtil.bufferLoaderHelper(request, buffer, 12, (smartBuffer) => {
29
33
  ProtocolUtil_1.protocolUtil.loadCommonRequestFields(request, smartBuffer);
34
+ //the flags field is only present on firmware that supports it; older firmware omits it entirely
35
+ if (smartBuffer.remaining() >= 4) {
36
+ const threadsRequestFlags = smartBuffer.readUInt32LE(); // threads_request_flags
37
+ request.data.includeIdentityInfo = !!(threadsRequestFlags & ThreadRequestFlags.includeIdentityInfo);
38
+ }
39
+ else {
40
+ request.data.includeIdentityInfo = false;
41
+ }
30
42
  });
31
43
  return request;
32
44
  }
33
45
  toBuffer() {
34
46
  const smartBuffer = new smart_buffer_1.SmartBuffer();
47
+ //older firmware doesn't expect the flags field at all, so we only include it when configured.
48
+ if (this.data.includeIdentityInfo) {
49
+ let threadsRequestFlags = 0;
50
+ threadsRequestFlags |= this.data.includeIdentityInfo ? ThreadRequestFlags.includeIdentityInfo : 0;
51
+ smartBuffer.writeUInt32LE(threadsRequestFlags); // threads_request_flags
52
+ }
35
53
  ProtocolUtil_1.protocolUtil.insertCommonRequestFields(this, smartBuffer);
36
54
  return smartBuffer.toBuffer();
37
55
  }
38
56
  }
39
57
  exports.ThreadsRequest = ThreadsRequest;
58
+ var ThreadRequestFlags;
59
+ (function (ThreadRequestFlags) {
60
+ ThreadRequestFlags[ThreadRequestFlags["includeIdentityInfo"] = 1] = "includeIdentityInfo";
61
+ })(ThreadRequestFlags = exports.ThreadRequestFlags || (exports.ThreadRequestFlags = {}));
40
62
  //# sourceMappingURL=ThreadsRequest.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ThreadsRequest.js","sourceRoot":"","sources":["../../../../src/debugProtocol/events/requests/ThreadsRequest.ts"],"names":[],"mappings":";;;AAAA,+CAA2C;AAC3C,+CAA0C;AAC1C,qDAAkD;AAGlD,MAAa,cAAc;IAA3B;QAsBW,YAAO,GAAG,KAAK,CAAC;QACvB;;WAEG;QACI,eAAU,GAAW,SAAS,CAAC;QAE/B,SAAI,GAAG;YACV,cAAc;YACd,YAAY,EAAE,SAAmB;YACjC,SAAS,EAAE,SAAmB;YAC9B,OAAO,EAAE,mBAAO,CAAC,OAAO;SAC3B,C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W,CAAC,QAAQ,EAAE,CAAC;IAClC,CAAC;CAsBJ;AAzDD,wCAyDC;AAED,IAAY,kBAEX;AAFD,WAAY,kBAAkB;IAC1B,yFAA4B,CAAA;AAChC,CAAC,EAFW,kBAAkB,GAAlB,0BAAkB,KAAlB,0BAAkB,QAE7B"}
@@ -56,4 +56,16 @@ export interface ThreadInfo {
56
56
  * The code causing the stop or failure.
57
57
  */
58
58
  codeSnippet: string;
59
+ /**
60
+ * The ID of the thread (optional for debug protocol version ).
61
+ */
62
+ osThreadId?: string;
63
+ /**
64
+ * The name of the thread (optional).
65
+ */
66
+ name?: string;
67
+ /**
68
+ * The type of the thread (optional).
69
+ */
70
+ type?: string;
59
71
  }
@@ -42,25 +42,33 @@ class ThreadsResponse {
42
42
  const flags = smartBuffer.readUInt8();
43
43
  thread.isPrimary = (flags & ThreadInfoFlags.isPrimary) > 0;
44
44
  thread.isDetached = (flags & ThreadInfoFlags.isDetached) > 0;
45
+ const includesIdentityInfo = (flags & ThreadInfoFlags.includesIdentityInfo) > 0;
45
46
  thread.stopReason = Constants_1.StopReasonCode[smartBuffer.readUInt32LE()]; // stop_reason
46
47
  thread.stopReasonDetail = ProtocolUtil_1.protocolUtil.readStringNT(smartBuffer); // stop_reason_detail
47
48
  thread.lineNumber = smartBuffer.readUInt32LE(); // line_number
48
49
  thread.functionName = ProtocolUtil_1.protocolUtil.readStringNT(smartBuffer); // function_name
49
50
  thread.filePath = ProtocolUtil_1.protocolUtil.readStringNT(smartBuffer); // file_path
50
51
  thread.codeSnippet = ProtocolUtil_1.protocolUtil.readStringNT(smartBuffer); // code_snippet
52
+ if (includesIdentityInfo) {
53
+ thread.osThreadId = ProtocolUtil_1.protocolUtil.readStringNT(smartBuffer); // id
54
+ thread.name = ProtocolUtil_1.protocolUtil.readStringNT(smartBuffer); // name
55
+ thread.type = ProtocolUtil_1.protocolUtil.readStringNT(smartBuffer); // type
56
+ }
51
57
  response.data.threads.push(thread);
52
58
  }
53
59
  });
54
60
  return response;
55
61
  }
56
62
  toBuffer() {
57
- var _a, _b, _c;
63
+ var _a, _b, _c, _d, _e, _f, _g, _h;
58
64
  const smartBuffer = new smart_buffer_1.SmartBuffer();
59
65
  smartBuffer.writeUInt32LE((_b = (_a = this.data.threads) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0); // threads_count
60
- for (const thread of (_c = this.data.threads) !== null && _c !== void 0 ? _c : []) {
66
+ const includesIdentityInfo = (_d = (_c = this.data.threads) === null || _c === void 0 ? void 0 : _c.some(t => t.osThreadId || t.name || t.type)) !== null && _d !== void 0 ? _d : false;
67
+ for (const thread of (_e = this.data.threads) !== null && _e !== void 0 ? _e : []) {
61
68
  let flags = 0;
62
- flags |= thread.isPrimary ? 1 : 0;
63
- flags |= thread.isDetached ? 2 : 0;
69
+ flags |= thread.isPrimary ? ThreadInfoFlags.isPrimary : 0;
70
+ flags |= thread.isDetached ? ThreadInfoFlags.isDetached : 0;
71
+ flags |= includesIdentityInfo ? ThreadInfoFlags.includesIdentityInfo : 0;
64
72
  smartBuffer.writeUInt8(flags); //flags
65
73
  //stop_reason is an 8-bit value (same as the other locations in this protocol); however, it is sent in this response as a 32bit value for historical purposes
66
74
  smartBuffer.writeUInt32LE(Constants_1.StopReasonCode[thread.stopReason]); // stop_reason
@@ -69,6 +77,11 @@ class ThreadsResponse {
69
77
  smartBuffer.writeStringNT(thread.functionName); // function_name
70
78
  smartBuffer.writeStringNT(thread.filePath); // file_path
71
79
  smartBuffer.writeStringNT(thread.codeSnippet); // code_snippet
80
+ if (includesIdentityInfo) {
81
+ smartBuffer.writeStringNT((_f = thread.osThreadId) !== null && _f !== void 0 ? _f : '');
82
+ smartBuffer.writeStringNT((_g = thread.name) !== null && _g !== void 0 ? _g : '');
83
+ smartBuffer.writeStringNT((_h = thread.type) !== null && _h !== void 0 ? _h : '');
84
+ }
72
85
  }
73
86
  ProtocolUtil_1.protocolUtil.insertCommonResponseFields(this, smartBuffer);
74
87
  return smartBuffer.toBuffer();
@@ -79,5 +92,9 @@ var ThreadInfoFlags;
79
92
  (function (ThreadInfoFlags) {
80
93
  ThreadInfoFlags[ThreadInfoFlags["isPrimary"] = 1] = "isPrimary";
81
94
  ThreadInfoFlags[ThreadInfoFlags["isDetached"] = 2] = "isDetached";
95
+ /**
96
+ * Does the response include the optional identity info fields (id, name, type)?
97
+ */
98
+ ThreadInfoFlags[ThreadInfoFlags["includesIdentityInfo"] = 4] = "includesIdentityInfo";
82
99
  })(ThreadInfoFlags || (ThreadInfoFlags = {}));
83
100
  //# sourceMappingURL=ThreadsResponse.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ThreadsResponse.js","sourceRoot":"","sources":["../../../../src/debugProtocol/events/responses/ThreadsResponse.ts"],"names":[],"mappings":";;;AAAA,+BAA+B;AAC/B,+CAA2C;AAE3C,+CAA4D;AAC5D,qDAAkD;AAElD,MAAa,eAAe;IAA5B;QA2DW,YAAO,GAAG,KAAK,CAAC;QAEhB,eAAU,GAAG,CAAC,CAAC;QAEf,SAAI,GAAG;YACV;;;;eAIG;YACH,OAAO,EAAE,SAAyB;YAElC,kBAAkB;YAClB,YAAY,EAAE,SAAmB;YACjC,SAAS,EAAE,SAAmB;YAC9B,SAAS,EAAE,qBAAS,CAAC,EAAE;SAC1B,CAAC;IACN,CAAC;IA3EU,MAAM,CAAC,QAAQ,CAAC,IAGtB;;;QACG,MAAM,QAAQ,GAAG,IAAI,eAAe,EAAE,CAAC;QACvC,2BAAY,CAAC,QAAQ,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;QACtC,YAAA,QAAQ,CAAC,IAAI,EAAC,OAAO,uCAAP,OAAO,GAAK,EAAE,EAAC;QAC7B,OAAO,QAAQ,CAAC;IACpB,CAAC;IAEM,MAAM,CAAC,UAAU,CAAC,MAAc;QACnC,MAAM,QAAQ,GAAG,IAAI,eAAe,EAAE,CAAC;QACvC,2BAAY,CAAC,kBAAkB,CAAC,QAAQ,EAAE,MAAM,EAAE,EAAE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Aa,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC,cAAc;YAC5D,WAAW,CAAC,aAAa,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC,CAAC,gBAAgB;YAChE,WAAW,CAAC,aAAa,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,YAAY;YACxD,WAAW,CAAC,aAAa,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC,CAAC,eAAe;YAE9D,IAAI,oBAAoB,EAAE;gBACtB,WAAW,CAAC,aAAa,CAAC,MAAA,MAAM,CAAC,UAAU,mCAAI,EAAE,CAAC,CAAC;gBACnD,WAAW,CAAC,aAAa,CAAC,MAAA,MAAM,CAAC,IAAI,mCAAI,EAAE,CAAC,CAAC;gBAC7C,WAAW,CAAC,aAAa,CAAC,MAAA,MAAM,CAAC,IAAI,mCAAI,EAAE,CAAC,CAAC;aAChD;SACJ;QACD,2BAAY,CAAC,0BAA0B,CAAC,IAAI,EAAE,WAAW,CAAC,CAAC;QAC3D,OAAO,WAAW,CAAC,QAAQ,EAAE,CAAC;IAClC,CAAC;CAmBJ;AA5FD,0CA4FC;AAiDD,IAAK,eAOJ;AAPD,WAAK,eAAe;IAChB,+DAAgB,CAAA;IAChB,iEAAiB,CAAA;IACjB;;OAEG;IACH,qFAA2B,CAAA;AAC/B,CAAC,EAPI,eAAe,KAAf,eAAe,QAOnB"}
@@ -178,6 +178,13 @@ export declare class BrightScriptDebugSession extends LoggingDebugSession {
178
178
  setBreakPointsRequest(response: DebugProtocol.SetBreakpointsResponse, args: DebugProtocol.SetBreakpointsArguments): Promise<void>;
179
179
  protected exceptionInfoRequest(response: DebugProtocol.ExceptionInfoResponse, args: DebugProtocol.ExceptionInfoArguments): void;
180
180
  protected threadsRequest(response: DebugProtocol.ThreadsResponse): Promise<void>;
181
+ /**
182
+ * Get the thread name to display in the UI based on the thread info we have.
183
+ * This is what displays in the `call stack` region in vscode
184
+ * @param thread
185
+ * @returns
186
+ */
187
+ private getThreadName;
181
188
  protected stackTraceRequest(response: DebugProtocol.StackTraceResponse, args: DebugProtocol.StackTraceArguments): Promise<void>;
182
189
  protected scopesRequest(response: DebugProtocol.ScopesResponse, args: DebugProtocol.ScopesArguments): Promise<void>;
183
190
  protected continueRequest(response: DebugProtocol.ContinueResponse, args: DebugProtocol.ContinueArguments): Promise<void>;
@@ -432,7 +432,7 @@ class BrightScriptDebugSession extends debugadapter_1.LoggingDebugSession {
432
432
  return config;
433
433
  }
434
434
  async launchRequest(response, config) {
435
- var _a, _b, _c, _d, _e, _f, _g, _h, _j;
435
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
436
436
  const logEnd = this.logger.timeStart('log', '[launchRequest] launch');
437
437
  try {
438
438
  this.resetSessionState();
@@ -485,6 +485,12 @@ class BrightScriptDebugSession extends debugadapter_1.LoggingDebugSession {
485
485
  ]);
486
486
  //all of the projects have been successfully staged.
487
487
  this.stagingDefered.tryResolve();
488
+ //if the client supports it, let it process (inspect/modify) each project's staging dir before we package them
489
+ if ((_h = this.launchConfiguration.clientCapabilities) === null || _h === void 0 ? void 0 : _h.supportsProcessStagingDir) {
490
+ await this.sendCustomRequest('processStagingDir', {
491
+ projects: this.projectManager.getProjectStagingInfo()
492
+ });
493
+ }
488
494
  packageEnd();
489
495
  if (this.enableDebugProtocol) {
490
496
  util_1.util.log(`Connecting to Roku via the BrightScript debug protocol at ${this.launchConfiguration.host}:${this.launchConfiguration.controlPort}`);
@@ -531,8 +537,8 @@ class BrightScriptDebugSession extends debugadapter_1.LoggingDebugSession {
531
537
  util_1.util.log('Encountered an issue during the launch process');
532
538
  util_1.util.log(e === null || e === void 0 ? void 0 : e.stack);
533
539
  //send any compile errors to the client
534
- await ((_h = this.rokuAdapter) === null || _h === void 0 ? void 0 : _h.sendErrors());
535
- const message = (e instanceof Exceptions_1.SocketConnectionInUseError) ? e.message : ((_j = e === null || e === void 0 ? void 0 : e.stack) !== null && _j !== void 0 ? _j : e);
540
+ await ((_j = this.rokuAdapter) === null || _j === void 0 ? void 0 : _j.sendErrors());
541
+ const message = (e instanceof Exceptions_1.SocketConnectionInUseError) ? e.message : ((_k = e === null || e === void 0 ? void 0 : e.stack) !== null && _k !== void 0 ? _k : e);
536
542
  await this.shutdown(message, true);
537
543
  }
538
544
  else {
@@ -680,7 +686,7 @@ class BrightScriptDebugSession extends debugadapter_1.LoggingDebugSession {
680
686
  * Activate all required functionality for profiling
681
687
  */
682
688
  async initializeProfiling() {
683
- var _a, _b, _c, _d, _e;
689
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
684
690
  // Initialize PerfettoManager
685
691
  this.perfettoManager = new PerfettoManager_1.PerfettoManager({
686
692
  host: this.launchConfiguration.host,
@@ -724,6 +730,13 @@ class BrightScriptDebugSession extends debugadapter_1.LoggingDebugSession {
724
730
  else if (((_e = (_d = this.launchConfiguration.profiling) === null || _d === void 0 ? void 0 : _d.tracing) === null || _e === void 0 ? void 0 : _e.enable) === false && this.supportsPerfettoTracing) {
725
731
  this.logger.info('Disabling perfetto tracing because it is disabled in the launch configuration');
726
732
  //TODO implement a way to disable perfetto tracing on the device
733
+ //tracing was requested but the device firmware does not meet the minimum requirement
734
+ }
735
+ else if (((_g = (_f = this.launchConfiguration.profiling) === null || _f === void 0 ? void 0 : _f.tracing) === null || _g === void 0 ? void 0 : _g.enable) && !this.supportsPerfettoTracing) {
736
+ const firmwareVersion = (_j = (_h = this.deviceInfo) === null || _h === void 0 ? void 0 : _h.softwareVersion) !== null && _j !== void 0 ? _j : 'unknown';
737
+ const message = `Perfetto profiling is not available: device firmware ${firmwareVersion} is below the minimum required version (15.2). The Perfetto profiling buttons will not be available during this session.`;
738
+ this.logger.warn(message);
739
+ this.showPopupMessage(message, 'warn').catch(e => this.logger.error('Failed to show Perfetto unavailable notification', e));
727
740
  //profiling.tracing.enabled is set to `undefined`, which means we should do nothing
728
741
  }
729
742
  else {
@@ -734,7 +747,7 @@ class BrightScriptDebugSession extends debugadapter_1.LoggingDebugSession {
734
747
  * If profiling was marked "connectOnStart", try connecting right away
735
748
  */
736
749
  async tryProfilingConnectOnStart() {
737
- var _a, _b;
750
+ var _a, _b, _c, _d, _e, _f;
738
751
  if (((_b = (_a = this.launchConfiguration.profiling) === null || _a === void 0 ? void 0 : _a.tracing) === null || _b === void 0 ? void 0 : _b.connectOnStart) && this.supportsPerfettoTracing) {
739
752
  try {
740
753
  await this.perfettoManager.startTracing();
@@ -743,6 +756,12 @@ class BrightScriptDebugSession extends debugadapter_1.LoggingDebugSession {
743
756
  this.logger.error('Failed to start perfetto tracing on start', e);
744
757
  }
745
758
  }
759
+ else if (((_d = (_c = this.launchConfiguration.profiling) === null || _c === void 0 ? void 0 : _c.tracing) === null || _d === void 0 ? void 0 : _d.connectOnStart) && !this.supportsPerfettoTracing) {
760
+ const firmwareVersion = (_f = (_e = this.deviceInfo) === null || _e === void 0 ? void 0 : _e.softwareVersion) !== null && _f !== void 0 ? _f : 'unknown';
761
+ const message = `Perfetto profiling is not available: device firmware ${firmwareVersion} is below the minimum required version (15.2). Tracing will not start automatically.`;
762
+ this.logger.warn(message);
763
+ this.showPopupMessage(message, 'warn').catch(e => this.logger.error('Failed to show Perfetto unavailable notification', e));
764
+ }
746
765
  }
747
766
  /**
748
767
  * Clear certain properties that need reset whenever a debug session is restarted (via vscode or launched from the Roku home screen)
@@ -1302,9 +1321,7 @@ class BrightScriptDebugSession extends debugadapter_1.LoggingDebugSession {
1302
1321
  if (this.rokuAdapter.isAtDebuggerPrompt) {
1303
1322
  let rokuThreads = await this.rokuAdapter.getThreads();
1304
1323
  for (let thread of rokuThreads) {
1305
- const threadName = thread.isDetached
1306
- ? `Thread ${thread.threadId} [detached]`
1307
- : `Thread ${thread.threadId}`;
1324
+ const threadName = this.getThreadName(thread);
1308
1325
  threads.push(new debugadapter_1.Thread(thread.threadId, threadName));
1309
1326
  }
1310
1327
  if (threads.length === 0) {
@@ -1324,6 +1341,40 @@ class BrightScriptDebugSession extends debugadapter_1.LoggingDebugSession {
1324
1341
  };
1325
1342
  this.sendResponse(response);
1326
1343
  }
1344
+ /**
1345
+ * Get the thread name to display in the UI based on the thread info we have.
1346
+ * This is what displays in the `call stack` region in vscode
1347
+ * @param thread
1348
+ * @returns
1349
+ */
1350
+ getThreadName(thread) {
1351
+ let threadName = '';
1352
+ if (thread.type || thread.name || thread.osThreadId) {
1353
+ //build the name from only the parts that are present, so missing values don't leak into the name
1354
+ const parts = [];
1355
+ if (thread.type) {
1356
+ parts.push(`[${thread.type}]`);
1357
+ }
1358
+ if (thread.name) {
1359
+ parts.push(thread.name);
1360
+ }
1361
+ if (thread.osThreadId) {
1362
+ parts.push(thread.osThreadId);
1363
+ }
1364
+ threadName = parts.join(' ');
1365
+ }
1366
+ //remove any extraneous whitespace to deal with missing values
1367
+ threadName = threadName.replace(/\s+/g, ' ').trim();
1368
+ if (threadName === '') {
1369
+ threadName = `Thread ${thread.threadId}`;
1370
+ }
1371
+ if (thread.isDetached) {
1372
+ threadName += ' [detached]';
1373
+ }
1374
+ //remove any extraneous whitespace to deal with missing values
1375
+ threadName = threadName.replace(/\s+/g, ' ').trim();
1376
+ return threadName;
1377
+ }
1327
1378
  async stackTraceRequest(response, args) {
1328
1379
  var _a, _b;
1329
1380
  try {