MCPcopy
hub / github.com/microsoft/vscode-js-debug / removeSource

Method removeSource

src/adapter/sourceContainer.ts:806–847  ·  view source on GitHub ↗
(source: Source, silent = false)

Source from the content-addressed store, hash-verified

804 }
805
806 public removeSource(source: Source, silent = false) {
807 const existing = this._sourceByReference.get(source.sourceReference);
808 if (existing === undefined) {
809 return; // already removed
810 }
811
812 this.logger.assert(
813 source === existing,
814 'Expected source to be the same as the existing reference',
815 );
816 this._sourceByReference.delete(source.sourceReference);
817
818 // check for overwrites:
819 if (this._sourceByOriginalUrl.get(source.url) === source) {
820 this._sourceByOriginalUrl.delete(source.url);
821 }
822
823 if (source instanceof SourceFromMap) {
824 this._sourceMapSourcesByUrl.delete(source.url);
825 for (const [compiled, key] of source.compiledToSourceUrl) {
826 compiled.sourceMap.sourceByUrl.delete(key);
827 }
828 }
829
830 this._sourceByAbsolutePath.delete(source.absolutePath);
831 if (isSourceWithMap(source)) {
832 this._permanentlyDisabledSourceMaps.delete(source);
833 this._temporarilyDisabledSourceMaps.delete(source);
834 }
835
836 if (!silent && source.hasBeenAnnounced) {
837 source.toDap().then(dap => this._dap.loadedSource({ reason: 'removed', source: dap }));
838 }
839
840 if (isSourceWithWasm(source)) {
841 source.sourceMap.value.promise.then(w => w?.dispose());
842 }
843
844 if (isSourceWithMap(source)) {
845 this._removeSourceMapSources(source, silent);
846 }
847 }
848
849 /**
850 * Sends a 'loadedSource' event for the given source.

Callers 5

clearMethod · 0.95
_addSourceMethod · 0.95
_addSourceMapSourcesMethod · 0.95
removeMethod · 0.80

Calls 9

isSourceWithMapFunction · 0.90
isSourceWithWasmFunction · 0.90
loadedSourceMethod · 0.80
getMethod · 0.65
assertMethod · 0.65
deleteMethod · 0.65
toDapMethod · 0.65
disposeMethod · 0.65

Tested by

no test coverage detected