Skip to content

Rapid progress.report({increment}) values are lost #54295

Closed

Description

I talked shortly with Benjamin Pasero (@bpasero) on this commit. (A few hours have turned into a few days. Oops.)

  • VSCode Version: 1.25.1
  • OS Version: elementaryOS Loki (Ubuntu 16.04 Xenial)

Steps to Reproduce:

  1. An extension calls withProgress(...) to get a progress handle.
  2. Call progress.report({increment: value}) quickly in a short time frame
  3. The progress increments are lost.

Does this issue occur when all extensions are disabled?: Yes

As far as I can tell, the trouble is the debouncer for progress RPC. It "merges" repeated progress calls into a single progress RPM, but a faulty conditional prevents repeated increment values from being added together to sum up to the final value. See the linked commit.

Activity

  1. vscodebot commented on Jul 14, 2018

    @vscodebot

    (Experimental duplicate detection)
    Thanks for submitting this issue. Please also check if it is already covered by an existing one, like:

  2. bpasero commented on Jul 14, 2018

    @bpasero
    Contributor

    Colby Pike (@vector-of-bool) can you provide a small sample on top of a generated extension (via "yo code" generator - link).

  3. added
    info-needed
    on Jul 14, 2018
  4. vector-of-bool commented on Jul 14, 2018

    @vector-of-bool
    Author

    Sure. Should I attach the ext as an archive? Upload a repo? I could also just attach a VSIX.

    Here's the entirety of extension.ts, if that suffices:

    'use strict';
    import * as vscode from 'vscode';
    
    function pause(time: number): Thenable<void> {
      return new Promise(resolve => { setTimeout(() => { resolve(); }, time); });
    }
    
    export function activate() {
      vscode.commands.registerCommand('bad-progress.showProgress', () => {
        return vscode.window.withProgress(
            {location: vscode.ProgressLocation.Notification, title: 'Dummy Progress'},
            async (pr) => {
              let value = 0;
              while (value < 100) {
                // Wait for a random amount of time. Pauses less than the debounce time (100ms)
                // will cause the progress notification to lose increments.
                // With 200ms as the max pause, 1/2 increments will be lost. The
                // resulting progress bar will show about 1/2 progress.
                await pause(Math.random() * 200);
                value++;
                // Increment. Show the actual percentage for reference.
                pr.report({increment: 1, message: `Progress is at ${value}%`});
              }
              await pause(2000);
            },
        );
      });
    }
    
    export function deactivate() {}
  5. bpasero commented on Jul 14, 2018

    @bpasero
    Contributor

    Thanks, I can have a look.

  6. added
    bug
    workbench-notifications
    and removed
    info-needed
    on Jul 14, 2018
  7. added 2 commits that reference this issue on Jul 16, 2018
    b757388
    fafff47
  8. added
    verified
    on Aug 2, 2018
  9. locked and limited conversation to collaborators on Aug 30, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

bugverifiedworkbench-notifications

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions