Skip to content

Commit

Permalink
Clear validation timeouts when disposing the provider
Browse files Browse the repository at this point in the history
Closes #1
  • Loading branch information
remcohaszing committed Jun 28, 2024
1 parent 71fa9cf commit bf64a3e
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions src/monaco-marker-data-provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,15 +78,19 @@ export function registerMarkerDataProvider(
}

let handle: ReturnType<typeof setTimeout>
listeners.set(
model,
model.onDidChangeContent(() => {
const onDidChangeContent = model.onDidChangeContent(() => {
clearTimeout(handle)
handle = setTimeout(() => {
doValidate(model)
}, 500)
})

listeners.set(model, {
dispose() {
clearTimeout(handle)
handle = setTimeout(() => {
doValidate(model)
}, 500)
})
)
onDidChangeContent.dispose()
}
})

doValidate(model)
}
Expand Down

0 comments on commit bf64a3e

Please sign in to comment.