Skip to content

Commit

Permalink
Refactoring of deactivateCoverage
Browse files Browse the repository at this point in the history
  • Loading branch information
Den1552 committed Dec 20, 2024
1 parent ca80e6c commit 93956d3
Showing 1 changed file with 20 additions and 9 deletions.
29 changes: 20 additions & 9 deletions src/coverage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -277,15 +277,26 @@ export async function updateCOVdecorations() {
}

function deactivateCoverage() {
// delete all decorations
if (uncoveredDecorationType) uncoveredDecorationType.dispose();
if (coveredDecorationType) coveredDecorationType.dispose();
if (partiallyCoveredDecorationType) partiallyCoveredDecorationType.dispose();
if (coveredDecorationTypeWithMCDC) coveredDecorationTypeWithMCDC.dispose();
if (uncoveredDecorationTypeWithMCDC)
uncoveredDecorationTypeWithMCDC.dispose();
if (partiallyCoveredDecorationTypeWithMCDC)
partiallyCoveredDecorationTypeWithMCDC.dispose();
const decorationTypes = [
uncoveredDecorationType,
coveredDecorationType,
partiallyCoveredDecorationType,
coveredDecorationTypeWithMCDC,
uncoveredDecorationTypeWithMCDC,
partiallyCoveredDecorationTypeWithMCDC,
];

// Debug log to verify contents of decorationTypes
console.log("Decoration Types Before Disposal:", decorationTypes);

// Iterate over the list and dispose of each decoration type if it exists
for (const decorationType of decorationTypes) {
if (decorationType) {
console.log("Disposing decoration type:", decorationType);
decorationType.dispose();
}
}

coverageStatusBarObject.hide();
}

Expand Down

0 comments on commit 93956d3

Please sign in to comment.