roku-debug 0.20.6 → 0.20.7

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 (211) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/dist/CompileErrorProcessor.d.ts +7 -2
  3. package/dist/CompileErrorProcessor.js +64 -69
  4. package/dist/CompileErrorProcessor.js.map +1 -1
  5. package/dist/DeviceInfo.d.ts +1 -0
  6. package/dist/adapters/DebugProtocolAdapter.d.ts +64 -17
  7. package/dist/adapters/DebugProtocolAdapter.js +264 -157
  8. package/dist/adapters/DebugProtocolAdapter.js.map +1 -1
  9. package/dist/adapters/TelnetAdapter.d.ts +8 -3
  10. package/dist/adapters/TelnetAdapter.js +14 -6
  11. package/dist/adapters/TelnetAdapter.js.map +1 -1
  12. package/dist/debugProtocol/Constants.d.ts +171 -81
  13. package/dist/debugProtocol/Constants.js +206 -126
  14. package/dist/debugProtocol/Constants.js.map +1 -1
  15. package/dist/debugProtocol/DebugProtocolClientReplaySession.d.ts +46 -0
  16. package/dist/debugProtocol/DebugProtocolClientReplaySession.js +278 -0
  17. package/dist/debugProtocol/DebugProtocolClientReplaySession.js.map +1 -0
  18. package/dist/debugProtocol/PluginInterface.d.ts +38 -0
  19. package/dist/debugProtocol/PluginInterface.js +86 -0
  20. package/dist/debugProtocol/PluginInterface.js.map +1 -0
  21. package/dist/debugProtocol/ProtocolUtil.d.ts +56 -0
  22. package/dist/debugProtocol/ProtocolUtil.js +164 -0
  23. package/dist/debugProtocol/ProtocolUtil.js.map +1 -0
  24. package/dist/debugProtocol/client/DebugProtocolClient.d.ts +310 -0
  25. package/dist/debugProtocol/client/DebugProtocolClient.js +1079 -0
  26. package/dist/debugProtocol/client/DebugProtocolClient.js.map +1 -0
  27. package/dist/debugProtocol/client/DebugProtocolClientPlugin.d.ts +44 -0
  28. package/dist/debugProtocol/client/DebugProtocolClientPlugin.js +3 -0
  29. package/dist/debugProtocol/client/DebugProtocolClientPlugin.js.map +1 -0
  30. package/dist/debugProtocol/events/ProtocolEvent.d.ts +66 -0
  31. package/dist/debugProtocol/events/ProtocolEvent.js +3 -0
  32. package/dist/debugProtocol/events/ProtocolEvent.js.map +1 -0
  33. package/dist/debugProtocol/events/requests/AddBreakpointsRequest.d.ts +30 -0
  34. package/dist/debugProtocol/events/requests/AddBreakpointsRequest.js +63 -0
  35. package/dist/debugProtocol/events/requests/AddBreakpointsRequest.js.map +1 -0
  36. package/dist/debugProtocol/events/requests/AddConditionalBreakpointsRequest.d.ts +48 -0
  37. package/dist/debugProtocol/events/requests/AddConditionalBreakpointsRequest.js +69 -0
  38. package/dist/debugProtocol/events/requests/AddConditionalBreakpointsRequest.js.map +1 -0
  39. package/dist/debugProtocol/events/requests/ContinueRequest.d.ts +20 -0
  40. package/dist/debugProtocol/events/requests/ContinueRequest.js +40 -0
  41. package/dist/debugProtocol/events/requests/ContinueRequest.js.map +1 -0
  42. package/dist/debugProtocol/events/requests/ExecuteRequest.d.ts +26 -0
  43. package/dist/debugProtocol/events/requests/ExecuteRequest.js +49 -0
  44. package/dist/debugProtocol/events/requests/ExecuteRequest.js.map +1 -0
  45. package/dist/debugProtocol/events/requests/ExitChannelRequest.d.ts +20 -0
  46. package/dist/debugProtocol/events/requests/ExitChannelRequest.js +40 -0
  47. package/dist/debugProtocol/events/requests/ExitChannelRequest.js.map +1 -0
  48. package/dist/debugProtocol/events/requests/HandshakeRequest.d.ts +26 -0
  49. package/dist/debugProtocol/events/requests/HandshakeRequest.js +47 -0
  50. package/dist/debugProtocol/events/requests/HandshakeRequest.js.map +1 -0
  51. package/dist/debugProtocol/events/requests/ListBreakpointsRequest.d.ts +20 -0
  52. package/dist/debugProtocol/events/requests/ListBreakpointsRequest.js +40 -0
  53. package/dist/debugProtocol/events/requests/ListBreakpointsRequest.js.map +1 -0
  54. package/dist/debugProtocol/events/requests/RemoveBreakpointsRequest.d.ts +29 -0
  55. package/dist/debugProtocol/events/requests/RemoveBreakpointsRequest.js +60 -0
  56. package/dist/debugProtocol/events/requests/RemoveBreakpointsRequest.js.map +1 -0
  57. package/dist/debugProtocol/events/requests/StackTraceRequest.d.ts +22 -0
  58. package/dist/debugProtocol/events/requests/StackTraceRequest.js +43 -0
  59. package/dist/debugProtocol/events/requests/StackTraceRequest.js.map +1 -0
  60. package/dist/debugProtocol/events/requests/StepRequest.d.ts +25 -0
  61. package/dist/debugProtocol/events/requests/StepRequest.js +46 -0
  62. package/dist/debugProtocol/events/requests/StepRequest.js.map +1 -0
  63. package/dist/debugProtocol/events/requests/StopRequest.d.ts +20 -0
  64. package/dist/debugProtocol/events/requests/StopRequest.js +39 -0
  65. package/dist/debugProtocol/events/requests/StopRequest.js.map +1 -0
  66. package/dist/debugProtocol/events/requests/ThreadsRequest.d.ts +20 -0
  67. package/dist/debugProtocol/events/requests/ThreadsRequest.js +40 -0
  68. package/dist/debugProtocol/events/requests/ThreadsRequest.js.map +1 -0
  69. package/dist/debugProtocol/events/requests/VariablesRequest.d.ts +59 -0
  70. package/dist/debugProtocol/events/requests/VariablesRequest.js +123 -0
  71. package/dist/debugProtocol/events/requests/VariablesRequest.js.map +1 -0
  72. package/dist/debugProtocol/events/responses/AddBreakpointsResponse.js.map +1 -0
  73. package/dist/debugProtocol/events/responses/AddConditionalBreakpointsResponse.d.ts +3 -0
  74. package/dist/debugProtocol/events/responses/AddConditionalBreakpointsResponse.js +9 -0
  75. package/dist/debugProtocol/events/responses/AddConditionalBreakpointsResponse.js.map +1 -0
  76. package/dist/debugProtocol/events/responses/ExecuteV3Response.d.ts +42 -0
  77. package/dist/debugProtocol/events/responses/ExecuteV3Response.js +94 -0
  78. package/dist/debugProtocol/events/responses/ExecuteV3Response.js.map +1 -0
  79. package/dist/debugProtocol/events/responses/GenericResponse.d.ts +17 -0
  80. package/dist/debugProtocol/events/responses/GenericResponse.js +40 -0
  81. package/dist/debugProtocol/events/responses/GenericResponse.js.map +1 -0
  82. package/dist/debugProtocol/events/responses/GenericV3Response.d.ts +15 -0
  83. package/dist/debugProtocol/events/responses/GenericV3Response.js +38 -0
  84. package/dist/debugProtocol/events/responses/GenericV3Response.js.map +1 -0
  85. package/dist/debugProtocol/events/responses/HandshakeResponse.d.ts +28 -0
  86. package/dist/debugProtocol/events/responses/HandshakeResponse.js +69 -0
  87. package/dist/debugProtocol/events/responses/HandshakeResponse.js.map +1 -0
  88. package/dist/debugProtocol/events/responses/HandshakeV3Response.d.ts +42 -0
  89. package/dist/debugProtocol/events/responses/HandshakeV3Response.js +98 -0
  90. package/dist/debugProtocol/events/responses/HandshakeV3Response.js.map +1 -0
  91. package/dist/debugProtocol/events/responses/ListBreakpointsResponse.d.ts +35 -0
  92. package/dist/debugProtocol/events/responses/ListBreakpointsResponse.js +68 -0
  93. package/dist/debugProtocol/events/responses/ListBreakpointsResponse.js.map +1 -0
  94. package/dist/debugProtocol/events/responses/RemoveBreakpointsResponse.js.map +1 -0
  95. package/dist/debugProtocol/events/responses/StackTraceResponse.d.ts +24 -0
  96. package/dist/debugProtocol/events/responses/StackTraceResponse.js +72 -0
  97. package/dist/debugProtocol/events/responses/StackTraceResponse.js.map +1 -0
  98. package/dist/debugProtocol/events/responses/StackTraceV3Response.d.ts +37 -0
  99. package/dist/debugProtocol/events/responses/StackTraceV3Response.js +67 -0
  100. package/dist/debugProtocol/events/responses/StackTraceV3Response.js.map +1 -0
  101. package/dist/debugProtocol/events/responses/ThreadsResponse.d.ts +54 -0
  102. package/dist/debugProtocol/events/responses/ThreadsResponse.js +80 -0
  103. package/dist/debugProtocol/events/responses/ThreadsResponse.js.map +1 -0
  104. package/dist/debugProtocol/events/responses/VariablesResponse.d.ts +117 -0
  105. package/dist/debugProtocol/events/responses/VariablesResponse.js +335 -0
  106. package/dist/debugProtocol/events/responses/VariablesResponse.js.map +1 -0
  107. package/dist/debugProtocol/events/updates/AllThreadsStoppedUpdate.d.ts +35 -0
  108. package/dist/debugProtocol/events/updates/AllThreadsStoppedUpdate.js +58 -0
  109. package/dist/debugProtocol/events/updates/AllThreadsStoppedUpdate.js.map +1 -0
  110. package/dist/debugProtocol/events/updates/BreakpointErrorUpdate.d.ts +42 -0
  111. package/dist/debugProtocol/events/updates/BreakpointErrorUpdate.js +97 -0
  112. package/dist/debugProtocol/events/updates/BreakpointErrorUpdate.js.map +1 -0
  113. package/dist/debugProtocol/events/updates/BreakpointVerifiedUpdate.d.ts +41 -0
  114. package/dist/debugProtocol/events/updates/BreakpointVerifiedUpdate.js +74 -0
  115. package/dist/debugProtocol/events/updates/BreakpointVerifiedUpdate.js.map +1 -0
  116. package/dist/debugProtocol/events/updates/CompileErrorUpdate.d.ts +60 -0
  117. package/dist/debugProtocol/events/updates/CompileErrorUpdate.js +89 -0
  118. package/dist/debugProtocol/events/updates/CompileErrorUpdate.js.map +1 -0
  119. package/dist/debugProtocol/events/updates/IOPortOpenedUpdate.d.ts +23 -0
  120. package/dist/debugProtocol/events/updates/IOPortOpenedUpdate.js +49 -0
  121. package/dist/debugProtocol/events/updates/IOPortOpenedUpdate.js.map +1 -0
  122. package/dist/debugProtocol/events/updates/ThreadAttachedUpdate.d.ts +26 -0
  123. package/dist/debugProtocol/events/updates/ThreadAttachedUpdate.js +50 -0
  124. package/dist/debugProtocol/events/updates/ThreadAttachedUpdate.js.map +1 -0
  125. package/dist/debugProtocol/server/DebugProtocolServer.d.ts +110 -0
  126. package/dist/debugProtocol/server/DebugProtocolServer.js +306 -0
  127. package/dist/debugProtocol/server/DebugProtocolServer.js.map +1 -0
  128. package/dist/debugProtocol/server/DebugProtocolServerPlugin.d.ts +41 -0
  129. package/dist/debugProtocol/server/DebugProtocolServerPlugin.js +3 -0
  130. package/dist/debugProtocol/server/DebugProtocolServerPlugin.js.map +1 -0
  131. package/dist/debugSession/BrightScriptDebugSession.d.ts +9 -1
  132. package/dist/debugSession/BrightScriptDebugSession.js +178 -89
  133. package/dist/debugSession/BrightScriptDebugSession.js.map +1 -1
  134. package/dist/index.d.ts +2 -3
  135. package/dist/index.js +2 -3
  136. package/dist/index.js.map +1 -1
  137. package/dist/logging.d.ts +1 -0
  138. package/dist/logging.js +4 -2
  139. package/dist/logging.js.map +1 -1
  140. package/dist/managers/ActionQueue.d.ts +7 -1
  141. package/dist/managers/ActionQueue.js +27 -5
  142. package/dist/managers/ActionQueue.js.map +1 -1
  143. package/dist/managers/BreakpointManager.d.ts +82 -27
  144. package/dist/managers/BreakpointManager.js +168 -63
  145. package/dist/managers/BreakpointManager.js.map +1 -1
  146. package/dist/managers/ProjectManager.d.ts +3 -0
  147. package/dist/managers/ProjectManager.js +42 -36
  148. package/dist/managers/ProjectManager.js.map +1 -1
  149. package/dist/util.d.ts +8 -6
  150. package/dist/util.js +36 -19
  151. package/dist/util.js.map +1 -1
  152. package/package.json +14 -5
  153. package/roku-debug-0.20.7.tgz +0 -0
  154. package/dist/debugProtocol/Debugger.d.ts +0 -161
  155. package/dist/debugProtocol/Debugger.js +0 -635
  156. package/dist/debugProtocol/Debugger.js.map +0 -1
  157. package/dist/debugProtocol/responses/AddBreakpointsResponse.js.map +0 -1
  158. package/dist/debugProtocol/responses/BreakpointErrorUpdateResponse.d.ts +0 -32
  159. package/dist/debugProtocol/responses/BreakpointErrorUpdateResponse.js +0 -67
  160. package/dist/debugProtocol/responses/BreakpointErrorUpdateResponse.js.map +0 -1
  161. package/dist/debugProtocol/responses/BreakpointVerifiedUpdateResponse.d.ts +0 -32
  162. package/dist/debugProtocol/responses/BreakpointVerifiedUpdateResponse.js +0 -56
  163. package/dist/debugProtocol/responses/BreakpointVerifiedUpdateResponse.js.map +0 -1
  164. package/dist/debugProtocol/responses/ConnectIOPortResponse.d.ts +0 -10
  165. package/dist/debugProtocol/responses/ConnectIOPortResponse.js +0 -39
  166. package/dist/debugProtocol/responses/ConnectIOPortResponse.js.map +0 -1
  167. package/dist/debugProtocol/responses/ExecuteResponseV3.d.ts +0 -23
  168. package/dist/debugProtocol/responses/ExecuteResponseV3.js +0 -54
  169. package/dist/debugProtocol/responses/ExecuteResponseV3.js.map +0 -1
  170. package/dist/debugProtocol/responses/HandshakeResponse.d.ts +0 -12
  171. package/dist/debugProtocol/responses/HandshakeResponse.js +0 -39
  172. package/dist/debugProtocol/responses/HandshakeResponse.js.map +0 -1
  173. package/dist/debugProtocol/responses/HandshakeResponseV3.d.ts +0 -14
  174. package/dist/debugProtocol/responses/HandshakeResponseV3.js +0 -47
  175. package/dist/debugProtocol/responses/HandshakeResponseV3.js.map +0 -1
  176. package/dist/debugProtocol/responses/ListBreakpointsResponse.d.ts +0 -25
  177. package/dist/debugProtocol/responses/ListBreakpointsResponse.js +0 -65
  178. package/dist/debugProtocol/responses/ListBreakpointsResponse.js.map +0 -1
  179. package/dist/debugProtocol/responses/ProtocolEvent.d.ts +0 -11
  180. package/dist/debugProtocol/responses/ProtocolEvent.js +0 -38
  181. package/dist/debugProtocol/responses/ProtocolEvent.js.map +0 -1
  182. package/dist/debugProtocol/responses/ProtocolEventV3.d.ts +0 -11
  183. package/dist/debugProtocol/responses/ProtocolEventV3.js +0 -42
  184. package/dist/debugProtocol/responses/ProtocolEventV3.js.map +0 -1
  185. package/dist/debugProtocol/responses/RemoveBreakpointsResponse.js.map +0 -1
  186. package/dist/debugProtocol/responses/StackTraceResponse.d.ts +0 -18
  187. package/dist/debugProtocol/responses/StackTraceResponse.js +0 -58
  188. package/dist/debugProtocol/responses/StackTraceResponse.js.map +0 -1
  189. package/dist/debugProtocol/responses/StackTraceResponseV3.d.ts +0 -18
  190. package/dist/debugProtocol/responses/StackTraceResponseV3.js +0 -58
  191. package/dist/debugProtocol/responses/StackTraceResponseV3.js.map +0 -1
  192. package/dist/debugProtocol/responses/ThreadsResponse.d.ts +0 -22
  193. package/dist/debugProtocol/responses/ThreadsResponse.js +0 -63
  194. package/dist/debugProtocol/responses/ThreadsResponse.js.map +0 -1
  195. package/dist/debugProtocol/responses/UndefinedResponse.d.ts +0 -10
  196. package/dist/debugProtocol/responses/UndefinedResponse.js +0 -39
  197. package/dist/debugProtocol/responses/UndefinedResponse.js.map +0 -1
  198. package/dist/debugProtocol/responses/UpdateThreadsResponse.d.ts +0 -25
  199. package/dist/debugProtocol/responses/UpdateThreadsResponse.js +0 -91
  200. package/dist/debugProtocol/responses/UpdateThreadsResponse.js.map +0 -1
  201. package/dist/debugProtocol/responses/VariableResponse.d.ts +0 -27
  202. package/dist/debugProtocol/responses/VariableResponse.js +0 -141
  203. package/dist/debugProtocol/responses/VariableResponse.js.map +0 -1
  204. package/dist/debugProtocol/responses/index.d.ts +0 -11
  205. package/dist/debugProtocol/responses/index.js +0 -24
  206. package/dist/debugProtocol/responses/index.js.map +0 -1
  207. package/roku-debug-0.20.6.tgz +0 -0
  208. /package/dist/debugProtocol/{responses → events/responses}/AddBreakpointsResponse.d.ts +0 -0
  209. /package/dist/debugProtocol/{responses → events/responses}/AddBreakpointsResponse.js +0 -0
  210. /package/dist/debugProtocol/{responses → events/responses}/RemoveBreakpointsResponse.d.ts +0 -0
  211. /package/dist/debugProtocol/{responses → events/responses}/RemoveBreakpointsResponse.js +0 -0
@@ -21,10 +21,13 @@ const LocationManager_1 = require("../managers/LocationManager");
21
21
  const BreakpointManager_1 = require("../managers/BreakpointManager");
22
22
  const logging_1 = require("../logging");
23
23
  const xml2js = require("xml2js");
24
+ const VariablesResponse_1 = require("../debugProtocol/events/responses/VariablesResponse");
25
+ const brighterscript_1 = require("brighterscript");
26
+ const diagnosticSource = 'roku-debug';
24
27
  class BrightScriptDebugSession extends vscode_debugadapter_1.DebugSession {
25
28
  constructor() {
26
29
  super();
27
- this.logger = logging_1.logger.createLogger(`[${BrightScriptDebugSession.name}]`);
30
+ this.logger = logging_1.logger.createLogger(`[session]`);
28
31
  /**
29
32
  * A sequence used to help identify log statements for requests
30
33
  */
@@ -42,6 +45,10 @@ class BrightScriptDebugSession extends vscode_debugadapter_1.DebugSession {
42
45
  this.variables = {};
43
46
  this.variableHandles = new vscode_debugadapter_1.Handles();
44
47
  this.tempVarPrefix = '__rokudebug__';
48
+ /**
49
+ * A magic number to represent a fake thread that will be used for showing compile errors in the UI as if they were runtime crashes
50
+ */
51
+ this.COMPILE_ERROR_THREAD_ID = 7777;
45
52
  this.evaluateRequestPromise = Promise.resolve();
46
53
  this.evaluateVarIndexByFrameId = new Map();
47
54
  /**
@@ -59,24 +66,24 @@ class BrightScriptDebugSession extends vscode_debugadapter_1.DebugSession {
59
66
  this.locationManager = new LocationManager_1.LocationManager(this.sourceMapManager);
60
67
  this.breakpointManager = new BreakpointManager_1.BreakpointManager(this.sourceMapManager, this.locationManager);
61
68
  //send newly-verified breakpoints to vscode
62
- this.breakpointManager.on('breakpoints-verified', (data) => this.onDeviceVerifiedBreakpoints(data));
69
+ this.breakpointManager.on('breakpoints-verified', (data) => this.onDeviceBreakpointsChanged('changed', data));
63
70
  this.projectManager = new ProjectManager_1.ProjectManager(this.breakpointManager, this.locationManager);
64
71
  this.fileLoggingManager = new logging_1.FileLoggingManager();
65
72
  }
66
- onDeviceVerifiedBreakpoints(data) {
73
+ onDeviceBreakpointsChanged(eventName, data) {
67
74
  this.logger.info('Sending verified device breakpoints to client', data);
68
75
  //send all verified breakpoints to the client
69
76
  for (const breakpoint of data.breakpoints) {
70
77
  const event = {
71
78
  line: breakpoint.line,
72
79
  column: breakpoint.column,
73
- verified: true,
80
+ verified: breakpoint.verified,
74
81
  id: breakpoint.id,
75
82
  source: {
76
83
  path: breakpoint.srcPath
77
84
  }
78
85
  };
79
- this.sendEvent(new vscode_debugadapter_1.BreakpointEvent('changed', event));
86
+ this.sendEvent(new vscode_debugadapter_1.BreakpointEvent(eventName, event));
80
87
  }
81
88
  }
82
89
  get enableDebugProtocol() {
@@ -163,8 +170,10 @@ class BrightScriptDebugSession extends vscode_debugadapter_1.DebugSession {
163
170
  }
164
171
  }
165
172
  async launchRequest(response, config) {
166
- var _a;
173
+ var _a, _b, _c, _d;
167
174
  this.logger.log('[launchRequest] begin');
175
+ //send the response right away so the UI immediately shows the debugger toolbar
176
+ this.sendResponse(response);
168
177
  this.launchConfiguration = config;
169
178
  //set the logLevel provided by the launch config
170
179
  if (this.launchConfiguration.logLevel) {
@@ -263,26 +272,23 @@ class BrightScriptDebugSession extends vscode_debugadapter_1.DebugSession {
263
272
  this.sendEvent(new Events_1.LogOutputEvent(message));
264
273
  }
265
274
  });
266
- //ignore the compile error failure from within the publish
267
- this.launchConfiguration.failOnCompileError = false;
268
- // Set the remote debug flag on the args to be passed to roku deploy so the socket debugger can be started if needed.
269
- this.launchConfiguration.remoteDebug = this.enableDebugProtocol;
270
275
  await this.connectAndPublish();
271
276
  this.sendEvent(new Events_1.ChannelPublishedEvent(this.launchConfiguration));
272
277
  //tell the adapter adapter that the channel has been launched.
273
278
  await this.rokuAdapter.activate();
279
+ if (this.rokuAdapter.isDestroyed) {
280
+ throw new Error('Debug session encountered an error');
281
+ }
274
282
  if (!error) {
275
283
  if (this.rokuAdapter.connected) {
276
284
  this.logger.info('Host connection was established before the main public process was completed');
277
285
  this.logger.log(`deployed to Roku@${this.launchConfiguration.host}`);
278
- this.sendResponse(response);
279
286
  }
280
287
  else {
281
288
  this.logger.info('Main public process was completed but we are still waiting for a connection to the host');
282
289
  this.rokuAdapter.on('connected', (status) => {
283
290
  if (status) {
284
291
  this.logger.log(`deployed to Roku@${this.launchConfiguration.host}`);
285
- this.sendResponse(response);
286
292
  }
287
293
  });
288
294
  }
@@ -295,13 +301,11 @@ class BrightScriptDebugSession extends vscode_debugadapter_1.DebugSession {
295
301
  //if the message is anything other than compile errors, we want to display the error
296
302
  if (!(e instanceof roku_deploy_1.CompileError)) {
297
303
  util_1.util.log('Encountered an issue during the publish process');
298
- util_1.util.log(e.message);
299
- this.sendErrorResponse(response, -1, e.message);
304
+ util_1.util.log((_b = e) === null || _b === void 0 ? void 0 : _b.stack);
305
+ this.sendErrorResponse(response, -1, (_c = e) === null || _c === void 0 ? void 0 : _c.stack);
306
+ //send any compile errors to the client
307
+ await ((_d = this.rokuAdapter) === null || _d === void 0 ? void 0 : _d.sendErrors());
300
308
  }
301
- //send any compile errors to the client
302
- await this.rokuAdapter.sendErrors();
303
- this.logger.error('Error. Shutting down.', e);
304
- return this.shutdown();
305
309
  }
306
310
  //at this point, the project has been deployed. If we need to use a deep link, launch it now.
307
311
  if (this.launchConfiguration.deepLinkUrl) {
@@ -357,6 +361,7 @@ class BrightScriptDebugSession extends vscode_debugadapter_1.DebugSession {
357
361
  async handleDiagnostics(diagnostics) {
358
362
  // Roku device and sourcemap work with 1-based line numbers, VSCode expects 0-based lines.
359
363
  for (let diagnostic of diagnostics) {
364
+ diagnostic.source = diagnosticSource;
360
365
  let sourceLocation = await this.projectManager.getSourceLocation(diagnostic.path, diagnostic.range.start.line + 1);
361
366
  if (sourceLocation) {
362
367
  diagnostic.path = sourceLocation.filePath;
@@ -368,9 +373,12 @@ class BrightScriptDebugSession extends vscode_debugadapter_1.DebugSession {
368
373
  diagnostic.path = FileUtils_1.fileUtils.removeLeadingSlash(util_1.util.removeFileScheme(diagnostic.path));
369
374
  }
370
375
  }
376
+ //find the first compile error (i.e. first DiagnosticSeverity.Error) if there is one
377
+ this.compileError = diagnostics.find(x => x.severity === brighterscript_1.DiagnosticSeverity.Error);
378
+ if (this.compileError) {
379
+ this.sendEvent(new vscode_debugadapter_1.StoppedEvent(Events_1.StoppedEventReason.exception, this.COMPILE_ERROR_THREAD_ID, `CompileError: ${this.compileError.message}`));
380
+ }
371
381
  this.sendEvent(new Events_1.DiagnosticsEvent(diagnostics));
372
- //stop the roku adapter and exit the channel
373
- return this.shutdown();
374
382
  }
375
383
  async connectAndPublish() {
376
384
  let connectPromise;
@@ -390,9 +398,18 @@ class BrightScriptDebugSession extends vscode_debugadapter_1.DebugSession {
390
398
  //publish the package to the target Roku
391
399
  const publishPromise = this.rokuDeploy.publish({
392
400
  ...this.launchConfiguration,
401
+ //typing fix
402
+ logLevel: logging_1.LogLevelPriority[this.logger.logLevel],
403
+ // enable the debug protocol if true
404
+ remoteDebug: this.enableDebugProtocol,
405
+ //necessary for capturing compile errors from the protocol (has no effect on telnet)
406
+ remoteDebugConnectEarly: false,
407
+ //we don't want to fail if there were compile errors...we'll let our compile error processor handle that
393
408
  failOnCompileError: true
394
409
  }).then(() => {
395
410
  packageIsPublished = true;
411
+ }).catch((e) => {
412
+ this.logger.error(e);
396
413
  });
397
414
  await publishPromise;
398
415
  this.logger.log(`Uploading zip took ${Date.now() - start}ms`);
@@ -576,6 +593,7 @@ class BrightScriptDebugSession extends vscode_debugadapter_1.DebugSession {
576
593
  */
577
594
  async setBreakPointsRequest(response, args) {
578
595
  var _a;
596
+ this.logger.log('setBreakpointsRequest');
579
597
  let sanitizedBreakpoints = this.breakpointManager.replaceBreakpoints(args.source.path, args.breakpoints);
580
598
  //sort the breakpoints
581
599
  let sortedAndFilteredBreakpoints = (0, natural_orderby_1.orderBy)(sanitizedBreakpoints, [x => x.line, x => x.column]);
@@ -583,6 +601,7 @@ class BrightScriptDebugSession extends vscode_debugadapter_1.DebugSession {
583
601
  breakpoints: sortedAndFilteredBreakpoints
584
602
  };
585
603
  this.sendResponse(response);
604
+ this.logger.debug('[setBreakpointsRequest] syncBreakpoints()', args);
586
605
  await ((_a = this.rokuAdapter) === null || _a === void 0 ? void 0 : _a.syncBreakpoints());
587
606
  }
588
607
  exceptionInfoRequest(response, args) {
@@ -593,15 +612,21 @@ class BrightScriptDebugSession extends vscode_debugadapter_1.DebugSession {
593
612
  //wait for the roku adapter to load
594
613
  await this.getRokuAdapter();
595
614
  let threads = [];
596
- //only send the threads request if we are at the debugger prompt
597
- if (this.rokuAdapter.isAtDebuggerPrompt) {
598
- let rokuThreads = await this.rokuAdapter.getThreads();
599
- for (let thread of rokuThreads) {
600
- threads.push(new vscode_debugadapter_1.Thread(thread.threadId, `Thread ${thread.threadId}`));
601
- }
615
+ //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
616
+ if (this.compileError) {
617
+ threads.push(new vscode_debugadapter_1.Thread(this.COMPILE_ERROR_THREAD_ID, 'Compile Error'));
602
618
  }
603
619
  else {
604
- this.logger.log('Skipped getting threads because the RokuAdapter is not accepting input at this time.');
620
+ //only send the threads request if we are at the debugger prompt
621
+ if (this.rokuAdapter.isAtDebuggerPrompt) {
622
+ let rokuThreads = await this.rokuAdapter.getThreads();
623
+ for (let thread of rokuThreads) {
624
+ threads.push(new vscode_debugadapter_1.Thread(thread.threadId, `Thread ${thread.threadId}`));
625
+ }
626
+ }
627
+ else {
628
+ this.logger.log('Skipped getting threads because the RokuAdapter is not accepting input at this time.');
629
+ }
605
630
  }
606
631
  response.body = {
607
632
  threads: threads
@@ -613,36 +638,44 @@ class BrightScriptDebugSession extends vscode_debugadapter_1.DebugSession {
613
638
  try {
614
639
  this.logger.log('stackTraceRequest');
615
640
  let frames = [];
616
- if (this.rokuAdapter.isAtDebuggerPrompt) {
617
- let stackTrace = await this.rokuAdapter.getStackTrace(args.threadId);
618
- for (let debugFrame of stackTrace) {
619
- let sourceLocation = await this.projectManager.getSourceLocation(debugFrame.filePath, debugFrame.lineNumber);
620
- //the stacktrace returns function identifiers in all lower case. Try to get the actual case
621
- //load the contents of the file and get the correct casing for the function identifier
622
- try {
623
- let functionName = this.fileManager.getCorrectFunctionNameCase(sourceLocation === null || sourceLocation === void 0 ? void 0 : sourceLocation.filePath, debugFrame.functionIdentifier);
624
- if (functionName) {
625
- //search for original function name if this is an anonymous function.
626
- //anonymous function names are prefixed with $ in the stack trace (i.e. $anon_1 or $functionname_40002)
627
- if (functionName.startsWith('$')) {
628
- functionName = this.fileManager.getFunctionNameAtPosition(sourceLocation.filePath, sourceLocation.lineNumber - 1, functionName);
641
+ //this is a bit of a hack. If there's a compile error, send a full stack frame so we can show the compile error like a runtime crash
642
+ if (this.compileError) {
643
+ frames.push(new vscode_debugadapter_1.StackFrame(0, 'Compile Error', new vscode_debugadapter_1.Source(path.basename(this.compileError.path), this.compileError.path),
644
+ //diagnostics are 0 based, vscode expects 1 based
645
+ this.compileError.range.start.line + 1, this.compileError.range.start.character + 1));
646
+ }
647
+ else {
648
+ if (this.rokuAdapter.isAtDebuggerPrompt) {
649
+ let stackTrace = await this.rokuAdapter.getStackTrace(args.threadId);
650
+ for (let debugFrame of stackTrace) {
651
+ let sourceLocation = await this.projectManager.getSourceLocation(debugFrame.filePath, debugFrame.lineNumber);
652
+ //the stacktrace returns function identifiers in all lower case. Try to get the actual case
653
+ //load the contents of the file and get the correct casing for the function identifier
654
+ try {
655
+ let functionName = this.fileManager.getCorrectFunctionNameCase(sourceLocation === null || sourceLocation === void 0 ? void 0 : sourceLocation.filePath, debugFrame.functionIdentifier);
656
+ if (functionName) {
657
+ //search for original function name if this is an anonymous function.
658
+ //anonymous function names are prefixed with $ in the stack trace (i.e. $anon_1 or $functionname_40002)
659
+ if (functionName.startsWith('$')) {
660
+ functionName = this.fileManager.getFunctionNameAtPosition(sourceLocation.filePath, sourceLocation.lineNumber - 1, functionName);
661
+ }
662
+ debugFrame.functionIdentifier = functionName;
629
663
  }
630
- debugFrame.functionIdentifier = functionName;
631
664
  }
665
+ catch (error) {
666
+ this.logger.error('Error correcting function identifier case', { error, sourceLocation, debugFrame });
667
+ }
668
+ const filePath = (_a = sourceLocation === null || sourceLocation === void 0 ? void 0 : sourceLocation.filePath) !== null && _a !== void 0 ? _a : debugFrame.filePath;
669
+ const frame = new vscode_debugadapter_1.StackFrame(debugFrame.frameId, `${debugFrame.functionIdentifier}`, new vscode_debugadapter_1.Source(path.basename(filePath), filePath), (_b = sourceLocation === null || sourceLocation === void 0 ? void 0 : sourceLocation.lineNumber) !== null && _b !== void 0 ? _b : debugFrame.lineNumber, 1);
670
+ if (!sourceLocation) {
671
+ frame.presentationHint = 'subtle';
672
+ }
673
+ frames.push(frame);
632
674
  }
633
- catch (error) {
634
- this.logger.error('Error correcting function identifier case', { error, sourceLocation, debugFrame });
635
- }
636
- const filePath = (_a = sourceLocation === null || sourceLocation === void 0 ? void 0 : sourceLocation.filePath) !== null && _a !== void 0 ? _a : debugFrame.filePath;
637
- const frame = new vscode_debugadapter_1.StackFrame(debugFrame.frameId, `${debugFrame.functionIdentifier}`, new vscode_debugadapter_1.Source(path.basename(filePath), filePath), (_b = sourceLocation === null || sourceLocation === void 0 ? void 0 : sourceLocation.lineNumber) !== null && _b !== void 0 ? _b : debugFrame.lineNumber, 1);
638
- if (!sourceLocation) {
639
- frame.presentationHint = 'subtle';
640
- }
641
- frames.push(frame);
642
675
  }
643
- }
644
- else {
645
- this.logger.log('Skipped calculating stacktrace because the RokuAdapter is not accepting input at this time');
676
+ else {
677
+ this.logger.log('Skipped calculating stacktrace because the RokuAdapter is not accepting input at this time');
678
+ }
646
679
  }
647
680
  response.body = {
648
681
  stackFrames: frames,
@@ -659,7 +692,7 @@ class BrightScriptDebugSession extends vscode_debugadapter_1.DebugSession {
659
692
  logger.info('begin', { args });
660
693
  try {
661
694
  const scopes = new Array();
662
- if (this.enableDebugProtocol) {
695
+ if ((0, DebugProtocolAdapter_1.isDebugProtocolAdapter)(this.rokuAdapter)) {
663
696
  let refId = this.getEvaluateRefId('', args.frameId);
664
697
  let v;
665
698
  //if we already looked this item up, return it
@@ -667,7 +700,7 @@ class BrightScriptDebugSession extends vscode_debugadapter_1.DebugSession {
667
700
  v = this.variables[refId];
668
701
  }
669
702
  else {
670
- let result = await this.rokuAdapter.getVariable('', args.frameId, true);
703
+ let result = await this.rokuAdapter.getLocalVariables(args.frameId);
671
704
  if (!result) {
672
705
  throw new Error(`Could not get scopes`);
673
706
  }
@@ -696,12 +729,24 @@ class BrightScriptDebugSession extends vscode_debugadapter_1.DebugSession {
696
729
  }
697
730
  }
698
731
  async continueRequest(response, args) {
732
+ //if we have a compile error, we should shut down
733
+ if (this.compileError) {
734
+ this.sendResponse(response);
735
+ await this.shutdown();
736
+ return;
737
+ }
699
738
  this.logger.log('continueRequest');
700
739
  await this.rokuAdapter.continue();
701
740
  this.sendResponse(response);
702
741
  }
703
742
  async pauseRequest(response, args) {
704
743
  this.logger.log('pauseRequest');
744
+ //if we have a compile error, we should shut down
745
+ if (this.compileError) {
746
+ this.sendResponse(response);
747
+ await this.shutdown();
748
+ return;
749
+ }
705
750
  await this.rokuAdapter.pause();
706
751
  this.sendResponse(response);
707
752
  }
@@ -716,6 +761,12 @@ class BrightScriptDebugSession extends vscode_debugadapter_1.DebugSession {
716
761
  */
717
762
  async nextRequest(response, args) {
718
763
  this.logger.log('[nextRequest] begin');
764
+ //if we have a compile error, we should shut down
765
+ if (this.compileError) {
766
+ this.sendResponse(response);
767
+ await this.shutdown();
768
+ return;
769
+ }
719
770
  try {
720
771
  await this.rokuAdapter.stepOver(args.threadId);
721
772
  this.logger.info('[nextRequest] end');
@@ -727,12 +778,24 @@ class BrightScriptDebugSession extends vscode_debugadapter_1.DebugSession {
727
778
  }
728
779
  async stepInRequest(response, args) {
729
780
  this.logger.log('[stepInRequest]');
781
+ //if we have a compile error, we should shut down
782
+ if (this.compileError) {
783
+ this.sendResponse(response);
784
+ await this.shutdown();
785
+ return;
786
+ }
730
787
  await this.rokuAdapter.stepInto(args.threadId);
731
788
  this.sendResponse(response);
732
789
  this.logger.info('[stepInRequest] end');
733
790
  }
734
791
  async stepOutRequest(response, args) {
735
792
  this.logger.log('[stepOutRequest] begin');
793
+ //if we have a compile error, we should shut down
794
+ if (this.compileError) {
795
+ this.sendResponse(response);
796
+ await this.shutdown();
797
+ return;
798
+ }
736
799
  await this.rokuAdapter.stepOut(args.threadId);
737
800
  this.sendResponse(response);
738
801
  this.logger.info('[stepOutRequest] end');
@@ -761,7 +824,7 @@ class BrightScriptDebugSession extends vscode_debugadapter_1.DebugSession {
761
824
  logger.log('reference', reference);
762
825
  // NOTE: Legacy telnet support for local vars
763
826
  if (this.launchConfiguration.enableVariablesPanel) {
764
- const vars = await this.rokuAdapter.getScopeVariables(reference);
827
+ const vars = await this.rokuAdapter.getScopeVariables();
765
828
  for (const varName of vars) {
766
829
  let result = await this.rokuAdapter.getVariable(varName, -1);
767
830
  let tempVar = this.getVariableFromResult(result, -1);
@@ -819,6 +882,7 @@ class BrightScriptDebugSession extends vscode_debugadapter_1.DebugSession {
819
882
  return value;
820
883
  }
821
884
  async evaluateRequest(response, args) {
885
+ var _a;
822
886
  let deferred = (0, util_1.defer)();
823
887
  if (args.context === 'repl' && !this.enableDebugProtocol && args.expression.trim().startsWith('>')) {
824
888
  this.clearState();
@@ -856,11 +920,15 @@ class BrightScriptDebugSession extends vscode_debugadapter_1.DebugSession {
856
920
  let varIndex = this.getNextVarIndex(args.frameId);
857
921
  let arrayVarName = this.tempVarPrefix + 'eval';
858
922
  if (varIndex === 0) {
859
- await this.rokuAdapter.evaluate(`${arrayVarName} = []`, args.frameId);
923
+ const response = await this.rokuAdapter.evaluate(`${arrayVarName} = []`, args.frameId);
924
+ console.log(response);
860
925
  }
861
926
  let statement = `${arrayVarName}[${varIndex}] = ${args.expression}`;
862
927
  args.expression = `${arrayVarName}[${varIndex}]`;
863
928
  let commandResults = await this.rokuAdapter.evaluate(statement, args.frameId);
929
+ if (commandResults.type === 'error') {
930
+ throw new Error(commandResults.message);
931
+ }
864
932
  variablePath = [arrayVarName, varIndex.toString()];
865
933
  }
866
934
  //if we found a variable path (e.g. ['a', 'b', 'c']) then do a variable lookup because it's faster and more widely supported than `evaluate`
@@ -872,9 +940,9 @@ class BrightScriptDebugSession extends vscode_debugadapter_1.DebugSession {
872
940
  v = this.variables[refId];
873
941
  }
874
942
  else {
875
- let result = await this.rokuAdapter.getVariable(args.expression, args.frameId, true);
943
+ let result = await this.rokuAdapter.getVariable(args.expression, args.frameId);
876
944
  if (!result) {
877
- throw new Error(`bad variable request "${args.expression}"`);
945
+ throw new Error('Error: unable to evaluate expression');
878
946
  }
879
947
  v = this.getVariableFromResult(result, args.frameId);
880
948
  //TODO - testing something, remove later
@@ -920,12 +988,13 @@ class BrightScriptDebugSession extends vscode_debugadapter_1.DebugSession {
920
988
  }
921
989
  catch (error) {
922
990
  this.logger.error('Error during variables request', error);
991
+ response.success = false;
992
+ response.message = (_a = error === null || error === void 0 ? void 0 : error.message) !== null && _a !== void 0 ? _a : error;
923
993
  }
924
- //
925
994
  try {
926
995
  this.sendResponse(response);
927
996
  }
928
- catch (_a) { }
997
+ catch (_b) { }
929
998
  deferred.resolve();
930
999
  }
931
1000
  /**
@@ -934,19 +1003,16 @@ class BrightScriptDebugSession extends vscode_debugadapter_1.DebugSession {
934
1003
  * @param args
935
1004
  */
936
1005
  async disconnectRequest(response, args, request) {
937
- if (this.rokuAdapter) {
938
- await this.rokuAdapter.destroy();
939
- }
940
1006
  //return to the home screen
941
1007
  if (!this.enableDebugProtocol) {
942
1008
  await this.rokuDeploy.pressHomeButton(this.launchConfiguration.host, this.launchConfiguration.remotePort);
943
1009
  }
944
- this.componentLibraryServer.stop();
945
1010
  this.sendResponse(response);
1011
+ await this.shutdown();
946
1012
  }
947
1013
  createRokuAdapter(host, rendezvousTracker) {
948
1014
  if (this.enableDebugProtocol) {
949
- this.rokuAdapter = new DebugProtocolAdapter_1.DebugProtocolAdapter(this.launchConfiguration, this.projectManager, this.breakpointManager, rendezvousTracker);
1015
+ this.rokuAdapter = new DebugProtocolAdapter_1.DebugProtocolAdapter(this.launchConfiguration, this.projectManager, this.breakpointManager, rendezvousTracker, this.deviceInfo);
950
1016
  }
951
1017
  else {
952
1018
  this.rokuAdapter = new TelnetAdapter_1.TelnetAdapter(this.launchConfiguration, rendezvousTracker);
@@ -999,9 +1065,6 @@ class BrightScriptDebugSession extends vscode_debugadapter_1.DebugSession {
999
1065
  var _a, _b;
1000
1066
  //clear the index for storing evalutated expressions
1001
1067
  this.evaluateVarIndexByFrameId.clear();
1002
- //sync breakpoints
1003
- await ((_a = this.rokuAdapter) === null || _a === void 0 ? void 0 : _a.syncBreakpoints());
1004
- this.logger.info('received "suspend" event from adapter');
1005
1068
  const threads = await this.rokuAdapter.getThreads();
1006
1069
  const activeThread = threads.find(x => x.isSelected);
1007
1070
  //TODO remove this once Roku fixes their threads off-by-one line number issues
@@ -1015,6 +1078,21 @@ class BrightScriptDebugSession extends vscode_debugadapter_1.DebugSession {
1015
1078
  thread.lineNumber = stackTraceLineNumber;
1016
1079
  }
1017
1080
  }));
1081
+ outer: for (const bp of this.breakpointManager.failedDeletions) {
1082
+ for (const thread of threads) {
1083
+ let sourceLocation = await this.projectManager.getSourceLocation(thread.filePath, thread.lineNumber);
1084
+ // This stop was due to a breakpoint that we tried to delete, but couldn't.
1085
+ // Now that we are stopped, we can delete it. We won't stop here again unless you re-add the breakpoint. You're welcome.
1086
+ if ((bp.srcPath === sourceLocation.filePath) && (bp.line === sourceLocation.lineNumber)) {
1087
+ this.showPopupMessage(`Stopped at breakpoint that failed to delete. Deleting now, and should not cause future stops.`, 'info');
1088
+ this.logger.warn(`Stopped at breakpoint that failed to delete. Deleting now, and should not cause future stops`, bp, thread, sourceLocation);
1089
+ break outer;
1090
+ }
1091
+ }
1092
+ }
1093
+ //sync breakpoints
1094
+ await ((_a = this.rokuAdapter) === null || _a === void 0 ? void 0 : _a.syncBreakpoints());
1095
+ this.logger.info('received "suspend" event from adapter');
1018
1096
  //if !stopOnEntry, and we haven't encountered a suspend yet, THIS is the entry breakpoint. auto-continue
1019
1097
  if (!this.entryBreakpointWasHandled && !this.launchConfiguration.stopOnEntry) {
1020
1098
  this.entryBreakpointWasHandled = true;
@@ -1034,7 +1112,7 @@ class BrightScriptDebugSession extends vscode_debugadapter_1.DebugSession {
1034
1112
  this.sendEvent(event);
1035
1113
  }
1036
1114
  getVariableFromResult(result, frameId) {
1037
- var _a, _b, _c, _d;
1115
+ var _a, _b, _c, _d, _e;
1038
1116
  let v;
1039
1117
  if (result) {
1040
1118
  if (this.enableDebugProtocol) {
@@ -1052,7 +1130,17 @@ class BrightScriptDebugSession extends vscode_debugadapter_1.DebugSession {
1052
1130
  }
1053
1131
  }
1054
1132
  else {
1055
- v = new vscode_debugadapter_1.Variable(result.name, `${result.value}`);
1133
+ let value;
1134
+ if (result.type === VariablesResponse_1.VariableType.Invalid) {
1135
+ value = (_a = result.value) !== null && _a !== void 0 ? _a : 'Invalid';
1136
+ }
1137
+ else if (result.type === VariablesResponse_1.VariableType.Uninitialized) {
1138
+ value = 'Uninitialized';
1139
+ }
1140
+ else {
1141
+ value = `${result.value}`;
1142
+ }
1143
+ v = new vscode_debugadapter_1.Variable(result.name, value);
1056
1144
  }
1057
1145
  this.variables[refId] = v;
1058
1146
  }
@@ -1062,12 +1150,12 @@ class BrightScriptDebugSession extends vscode_debugadapter_1.DebugSession {
1062
1150
  }
1063
1151
  else if (result.highLevelType === 'array') {
1064
1152
  let refId = this.getEvaluateRefId(result.evaluateName, frameId);
1065
- v = new vscode_debugadapter_1.Variable(result.name, result.type, refId, (_b = (_a = result.children) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0, 0);
1153
+ v = new vscode_debugadapter_1.Variable(result.name, result.type, refId, (_c = (_b = result.children) === null || _b === void 0 ? void 0 : _b.length) !== null && _c !== void 0 ? _c : 0, 0);
1066
1154
  this.variables[refId] = v;
1067
1155
  }
1068
1156
  else if (result.highLevelType === 'object') {
1069
1157
  let refId = this.getEvaluateRefId(result.evaluateName, frameId);
1070
- v = new vscode_debugadapter_1.Variable(result.name, result.type, refId, 0, (_d = (_c = result.children) === null || _c === void 0 ? void 0 : _c.length) !== null && _d !== void 0 ? _d : 0);
1158
+ v = new vscode_debugadapter_1.Variable(result.name, result.type, refId, 0, (_e = (_d = result.children) === null || _d === void 0 ? void 0 : _d.length) !== null && _e !== void 0 ? _e : 0);
1071
1159
  this.variables[refId] = v;
1072
1160
  }
1073
1161
  else if (result.highLevelType === 'function') {
@@ -1091,6 +1179,10 @@ class BrightScriptDebugSession extends vscode_debugadapter_1.DebugSession {
1091
1179
  }
1092
1180
  v.childVariables = childVariables;
1093
1181
  }
1182
+ // if the var is an array and debugProtocol is enabled, include the array size
1183
+ if (this.enableDebugProtocol && v.type === VariablesResponse_1.VariableType.Array) {
1184
+ v.value = `${v.type}(${result.elementCount})`;
1185
+ }
1094
1186
  }
1095
1187
  return v;
1096
1188
  }
@@ -1142,13 +1234,13 @@ class BrightScriptDebugSession extends vscode_debugadapter_1.DebugSession {
1142
1234
  return this.shutdownPromise;
1143
1235
  }
1144
1236
  async _shutdown(errorMessage) {
1145
- var _a, _b, _c, _d, _e, _f;
1237
+ var _a, _b, _c, _d, _e, _f, _g;
1146
1238
  try {
1147
- //
1148
- (_b = (_a = this.rendezvousTracker) === null || _a === void 0 ? void 0 : _a.destroy) === null || _b === void 0 ? void 0 : _b.call(_a);
1239
+ (_a = this.componentLibraryServer) === null || _a === void 0 ? void 0 : _a.stop();
1240
+ (_c = (_b = this.rendezvousTracker) === null || _b === void 0 ? void 0 : _b.destroy) === null || _c === void 0 ? void 0 : _c.call(_b);
1149
1241
  //if configured, delete the staging directory
1150
1242
  if (!this.launchConfiguration.retainStagingFolder) {
1151
- const stagingFolders = (_d = (_c = this.projectManager) === null || _c === void 0 ? void 0 : _c.getStagingFolderPaths()) !== null && _d !== void 0 ? _d : [];
1243
+ const stagingFolders = (_e = (_d = this.projectManager) === null || _d === void 0 ? void 0 : _d.getStagingFolderPaths()) !== null && _e !== void 0 ? _e : [];
1152
1244
  this.logger.info('deleting staging folders', stagingFolders);
1153
1245
  for (let stagingFolderPath of stagingFolders) {
1154
1246
  try {
@@ -1165,18 +1257,15 @@ class BrightScriptDebugSession extends vscode_debugadapter_1.DebugSession {
1165
1257
  this.logger.error(errorMessage);
1166
1258
  this.showPopupMessage(errorMessage, 'error');
1167
1259
  }
1168
- if (this.launchConfiguration.stopDebuggerOnAppExit !== false) {
1169
- this.logger.log('Destroy rokuAdapter');
1170
- await ((_f = (_e = this.rokuAdapter) === null || _e === void 0 ? void 0 : _e.destroy) === null || _f === void 0 ? void 0 : _f.call(_e));
1171
- //press the home button to return to the home screen
1172
- try {
1173
- this.logger.log('Press home button');
1174
- await this.rokuDeploy.pressHomeButton(this.launchConfiguration.host, this.launchConfiguration.remotePort);
1175
- }
1176
- catch (e) {
1177
- console.error(e);
1178
- this.logger.error(e);
1179
- }
1260
+ this.logger.log('Destroy rokuAdapter');
1261
+ await ((_g = (_f = this.rokuAdapter) === null || _f === void 0 ? void 0 : _f.destroy) === null || _g === void 0 ? void 0 : _g.call(_f));
1262
+ //press the home button to return to the home screen
1263
+ try {
1264
+ this.logger.log('Press home button');
1265
+ await this.rokuDeploy.pressHomeButton(this.launchConfiguration.host, this.launchConfiguration.remotePort);
1266
+ }
1267
+ catch (e) {
1268
+ this.logger.error(e);
1180
1269
  }
1181
1270
  this.logger.log('Send terminated event');
1182
1271
  this.sendEvent(new vscode_debugadapter_1.TerminatedEvent());