Skip to content

Local history max entries not visually applied to timeline #145721

Closed

Description

@lramos15

Testing #145461

  1. Set workbench.localHistory.maxFileEntries to something small like 2
  2. Make some local history changes
  3. 🐛 Sometimes the list has 3 or more items in it as the deletes get processed. I would expect that even though file deletions and updates are async we should not render the extras in the list since this is the users specified max.

Activity

  1. added
    bug
    on Mar 23, 2022
  2. bpasero commented on Mar 23, 2022

    @bpasero
    Contributor

    We actually apply this setting in a way that we make sure to never return more than configured entries:

    const configuredMaxEntries = this.configurationService.getValue<number>(WorkingCopyHistoryModel.SETTINGS.MAX_ENTRIES, { resource: this.workingCopyResource });
    if (this.entries.length > configuredMaxEntries) {
    return this.entries.slice(this.entries.length - configuredMaxEntries);
    }

    However the timeline view behaves weird: I am sending an event that the entries have changed but unless I set reset: true, entries are just added on top:

    this._onDidChange.fire({
    id: LocalHistoryTimeline.ID,
    uri: entry?.workingCopy.resource,
    reset
    });

    Jackson Kearl (@JacksonKearl) any clue how I am supposed to set reset?

    When I change to always set reset: true, I see no more than the configured number of entries in the timeline, but I also think this will reset view state in case the user has scrolled down or selected an entry...

  3. changed the title [-]`workbench.localHistory.maxFileEntries` should be max list length regardless of async behavior[/-] [+]Local history max entries not visually applied to timeline[/+] on Mar 23, 2022
  4. JacksonKearl commented on Mar 24, 2022

    @JacksonKearl
    Contributor

    Stepping through this it would seem

    this._register(this.workingCopyHistoryService.onDidRemoveEntry(e => this.onDidChangeWorkingCopyHistoryEntry(e.entry, true /* entry removed */)));
    never actually gets called. I would expect that when the limit is hit, every new save event would trigger two events, one adding a new entry and one deleting the oldest entry. But I only see the one event firing to add the entry.

    Also, I am able to click into the events past the limit and their contents are correct, so the limit isn't being applied in some way.

  5. bpasero commented on Mar 24, 2022

    @bpasero
    Contributor

    Jackson Kearl (@JacksonKearl) imho the timeline API misses a way for me to indicate that an entry is removed. For performance reasons, local history entries are only removed on shutdown because otherwise every editor save is not only a file operation for creating the history entry but also a delete.

    I now gave up to be clever and just always set reset: true in the change event for the timeline to re-render everything 🤷

    reset: true // there is no other way to indicate that items might have been replaced/removed

    If we had the onDidRemoveEntry event together with the onDidAddEntry it would actually be worse because the first event would cause a change to the timeline to show the added entry and the second entry would reset the timeline.

  6. added
    unreleased
    on Mar 24, 2022
  7. added a commit that references this issue on Mar 25, 2022
    f6d5845
  8. added
    insiders-released
    and removed
    unreleased
    on Mar 25, 2022
  9. locked and limited conversation to collaborators on May 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

buginsiders-releasedtimelineverified

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions