-
Notifications
You must be signed in to change notification settings - Fork 233
Conversation
@codeworm96, It will cover your contributions to all Microsoft-managed open source projects. |
@codeworm96, |
@@ -106,6 +117,20 @@ export class UsbDetector { | |||
} | |||
} | |||
|
|||
public pauseListening() { | |||
if (this._usbDetector) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we resume the existing stopListening/startListening? The two new APIs seems duplicate
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In fact, it is possible but the startListening() method needs to be modified. The current startListening() just sets the add event listener and does not explicitly start listening. It works previously just because the detector is default to be listening after initialization. startListening() cannot switch back the status of detector correctly yet.
My concern is that it may be unnecessary to set the add event listener again and again.
src/extension.ts
Outdated
@@ -184,8 +183,8 @@ export async function activate(context: vscode.ExtensionContext) { | |||
const completionProvider = new CompletionProvider(); | |||
context.subscriptions.push(vscode.languages.registerCompletionItemProvider(ARDUINO_MODE, completionProvider, "<", '"', ".")); | |||
|
|||
usbDetector = new UsbDetector(context.extensionPath); | |||
usbDetector.startListening(); | |||
UsbDetector.extensionRoot = context.extensionPath; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can add Initialize(extensionRoot : string) method to UsbDector instance for passing value but not use the module to pass object value
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good advice.
src/serialmonitor/usbDetector.ts
Outdated
|
||
public static getInstance(): UsbDetector { | ||
if (!UsbDetector._instance) { | ||
UsbDetector._instance = new UsbDetector(UsbDetector.extensionRoot); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should check the extensionRoot value carefully since there is no any explicit of the sequence of the calling order
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not sure what behavior should be if the assumption is violated. Can you give me some advice?
Pause UsbDetector during uploading, so that the resetting of board during uploading will not trigger an annoying display of the board's README.