Skip to content

Progress

Progress indicators and notifications.

Progress

Progress(client: VSCodeClient, progress_id: str)

Represents a progress indicator.

Note: This is a simplified version. For complex progress scenarios, you may want to manage progress updates through custom events.

Create a progress indicator.

Parameters:

Name Type Description Default
client VSCodeClient

The VS Code client

required
progress_id str

Unique progress identifier

required
Source code in vscode_sockpuppet/progress.py
def __init__(self, client: "VSCodeClient", progress_id: str):
    """
    Create a progress indicator.

    Args:
        client: The VS Code client
        progress_id: Unique progress identifier
    """
    self.client = client
    self.progress_id = progress_id

report

report(message: Optional[str] = None, increment: Optional[int] = None) -> None

Report progress.

Parameters:

Name Type Description Default
message Optional[str]

Progress message

None
increment Optional[int]

Progress increment (percentage)

None
Source code in vscode_sockpuppet/progress.py
def report(self, message: Optional[str] = None, increment: Optional[int] = None) -> None:
    """
    Report progress.

    Args:
        message: Progress message
        increment: Progress increment (percentage)
    """
    # This would need additional server-side support
    # for real-time progress updates
    pass

ProgressLocation

ProgressLocation

Progress location options.

with_progress

with_progress

with_progress(client: VSCodeClient, location: str = ProgressLocation.Notification, title: str = '', cancellable: bool = False, message: Optional[str] = None) -> dict

Show a progress indicator.

Parameters:

Name Type Description Default
client VSCodeClient

The VS Code client

required
location str

Where to show progress (notification, window, sourcecontrol)

Notification
title str

Progress title

''
cancellable bool

Whether the operation can be cancelled

False
message Optional[str]

Initial progress message

None

Returns:

Type Description
dict

Result dictionary with success status

Example

with_progress( ... client, ... location=ProgressLocation.Notification, ... title="Processing", ... message="Please wait..." ... )

Source code in vscode_sockpuppet/progress.py
def with_progress(
    client: "VSCodeClient",
    location: str = ProgressLocation.Notification,
    title: str = "",
    cancellable: bool = False,
    message: Optional[str] = None,
) -> dict:
    """
    Show a progress indicator.

    Args:
        client: The VS Code client
        location: Where to show progress (notification, window, sourcecontrol)
        title: Progress title
        cancellable: Whether the operation can be cancelled
        message: Initial progress message

    Returns:
        Result dictionary with success status

    Example:
        >>> with_progress(
        ...     client,
        ...     location=ProgressLocation.Notification,
        ...     title="Processing",
        ...     message="Please wait..."
        ... )
    """
    return client._send_request(
        "window.withProgress",
        {
            "location": location,
            "title": title,
            "cancellable": cancellable,
            "message": message,
            "task": "wait",
        },
    )