Skip to content

SimpleDebounce should be a disposable #954

Description

@Tyriar

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:

    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 #952

Activity

  1. Copilot commented on Jun 23, 2026

    Copilot
    Contributor

    The agent encountered an error and was unable to start working on this issue: This may be caused by a repository ruleset violation. See granting bypass permissions for the agent, or please contact support if the issue persists. (Request id: FB5D:F78D0:9F538F:A1FF4D:6A39ED43)

  2. Copilot commented on Jun 23, 2026

    Copilot
    Contributor

    The agent encountered an error and was unable to start working on this issue: This may be caused by a repository ruleset violation. See granting bypass permissions for the agent, or please contact support if the issue persists. (Request id: 93F2:F9C18:849F24:B21DEA:6A3AB5C0)

  3. eleanorjboyd commented on Sep 23, 2026

    @eleanorjboyd
    Member

    🤖 Thanks for the report. The requested disposable implementation was added in 7d52871 through #952 and shipped in v1.12.0. SimpleDebounce now extends Disposable, and dispose() clears any pending timeout, so this is resolved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

debtCode quality issues

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions