MCPcopy Create free account
hub / github.com/Snapchat/Valdi / enable

Function enable

valdi/vscode_debugger/src/adapter/breakpoints/breakpointBase.ts:156–184  ·  view source on GitHub ↗

* Sets the breakpoint in the provided thread and marks the "enabled" bit.

(thread: Thread)

Source from the content-addressed store, hash-verified

154 * Sets the breakpoint in the provided thread and marks the "enabled" bit.
155 */
156 public async enable(thread: Thread): Promise<void> {
157 if (this.isEnabled) {
158 return;
159 }
160
161 this.isEnabled = true;
162 const promises: Promise<void>[] = [this._setPredicted(thread)];
163 const source = this._manager._sourceContainer.source(this.source);
164 if (!source || !(source instanceof SourceFromMap)) {
165 promises.push(
166 // For breakpoints set before launch, we don't know whether they are in a compiled or
167 // a source map source. To make them work, we always set by url to not miss compiled.
168 // Additionally, if we have two sources with the same url, but different path (or no path),
169 // this will make breakpoint work in all of them.
170 this._setByPath(thread, this.originalPosition),
171 );
172 }
173
174 if (source) {
175 const uiLocations = this._manager._sourceContainer.currentSiblingUiLocations({
176 lineNumber: this.originalPosition.lineNumber,
177 columnNumber: this.originalPosition.columnNumber,
178 source,
179 });
180 promises.push(...uiLocations.map(uiLocation => this._setByUiLocation(thread, uiLocation)));
181 }
182
183 await Promise.all(promises);
184 }
185
186 /**
187 * Updates the breakpoint's locations in the UI. Should be called whenever

Callers

nothing calls this directly

Calls 7

_setPredictedMethod · 0.80
_setByPathMethod · 0.80
sourceMethod · 0.65
allMethod · 0.65
pushMethod · 0.45
mapMethod · 0.45

Tested by

no test coverage detected