microsoft / microsoft/vscode-python-environments

SimpleDebounce should be a disposable

Open
#954 2 comments 1 reaction 3 assignees View on GitHub

Nobody has claimed this yet.

debt needs PR
Dominant language
TypeScript
Stars
138
Forks
62
Avg merge
1d 4h
Merged PRs (30d)
35

Description

This should be disposable:

https://github.com/microsoft/vscode-python-environments/blob/baad0daaa2e01f31ba507176e889bdfaf30d4cff/src/common/utils/debounce.ts#L1-L23

`dispose`'s impl should be:

```ts
public dispose() {
if (this.timeout) {
clearTimeout(this.timeout);
}
}
```

Not having this means that if the debouncer's job is done while the `setTimeout` is active, it will still fire again.

An example of this in practice is if the extension is disabled it should immediately dispose everything. Another example is the transient usage in https://github.com/microsoft/vscode-python-environments/pull/952

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.