Skip to content

Cursor and limit properties are ambiguous #94155

Closed

Description

Testing #93820

export interface TimelineOptions {
		/**
		 * A provider-defined cursor specifying the starting point of the timeline items that should be returned.
		 */
        cursor?: string;

		/**
		 * An optional maximum number timeline items or the all timeline items newer (inclusive) than the timestamp or id that should be returned.
		 * If `undefined` all timeline items should be returned.
		 */
        limit?: number | { timestamp: number; id?: string };
    }

There is a limit option that is overloaded with {timestamp: number; id?: string}. If I understand correctly when I am asked with this value, I shall have to return timeline items newer than this time stamp.

  • What shall I have to return if both timestamp and id are asked?
  • What is the use case to ask with timeline by id?
  • Why is it overloaded with limit property? It is not intuitive to understand
  • To me cursor property looks like a combination of limit + from or timestamp or index like pageSize + from. Am I missing anything here?

Activity

  1. eamodio commented on Apr 1, 2020

    @eamodio
    Contributor

    What shall I have to return if both timestamp and id are asked?

    It's up to the provider, and IDs (or lack of) are controlled by the provider. Ideally the provider would use the ID if possible (since that should be a more exact match), but it will depend on the source data/service whether or not that will be possible.

    What is the use case to ask with timeline by id?

    Here are the common usage combinations:

    { limit: number } — to get the first page (most recent)
    { limit: { timestamp: number; id?: string } — to get the most recent items, up to a set timeline item (or timestamp) -- we use this for providers with mutable histories (think git -- reset, rebase, etc), so when they tell us to update the timeline we can ask for all our current visible data
    { cursor: string, limit: number } — to get the next page of data starting at a specific point (cursor)
    { } — to get all items in one shot (no paging)
    { cursor: string } — to get all items in one shot starting from a specific point (we don't have to use this, since we can just use the above to get everything again).

    Why is it overloaded with limit property? It is not intuitive to understand

    Because limit is a signal for the end point of the data returned -- so up to a number of items, or up to a timestamp or specific item.

    To me cursor property looks like a combination of limit + from or timestamp or index like pageSize + from. Am I missing anything here?

    The cursor doesn't specify an end-point at all, it marks a starting point.

  2. sandy081 commented on Apr 1, 2020

    @sandy081
    MemberAuthor

    I am sorry to say that this is too complicated to understand. At the end I am lost what each property is and how they are associated. It seems they are intermingled with different terminologies.

    If it is for paging, I would expect this to be separated with filtering.

    Also filed separate issue for paging - #94178

  3. JacksonKearl commented on Apr 2, 2020

    @JacksonKearl
    Contributor

    I think perhaps this would be easier to implement if it were like:

    interface TimelineProvider {
       /* existing properties */
       
      // Get most recent `items` timelime items, starting after `start` if defined
      provideTimeline(uri: Uri, options: TimelineOptions, token: CancellationToken, items: number, start?: string): ProviderResult<Timeline>
    
      // Refresh items up to and including `cursor`
      updateTimeline?(uri: Uri, options: TimelineOptions, token: CancellationToken, cursor: string): ProviderResult<Timeline>
    
      // Not sure what this does tbh. Maybe not needed at all?
      fetchEntireTimeline?(...)
    }

    This way extensions can implement a minimal subset of the functionality and we can detect that in core and work around it. For instance, providers can minimally implement just provideTimeline. In that case, if they trigger a refresh the user will just get a single page back. If they go on to implement updateTimeline, then the user can get their full set of results back. I'm not really sure what the use case is for fetchEntireTimeline, but similar for that.

  4. eamodio commented on Apr 7, 2020

    @eamodio
    Contributor
  5. added
    info-needed
    on Apr 7, 2020
  6. github-actions commented on Apr 14, 2020

    @github-actions
    Contributor

    This issue has been closed automatically because it needs more information and has not had recent activity. See also our issue reporting guidelines.

    Happy Coding!

  7. locked and limited conversation to collaborators on May 29, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

info-neededtimeline

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions