@shopify/theme-language-server-common
Version:
<h1 align="center" style="position: relative;" > <br> <img src="https://github.com/Shopify/theme-check-vscode/blob/main/images/shopify_glyph.png?raw=true" alt="logo" width="141" height="160"> <br> Theme Language Server </h1>
43 lines (42 loc) • 1.64 kB
TypeScript
import { Connection } from 'vscode-languageserver';
import { ClientCapabilities } from './ClientCapabilities';
export interface IProgress {
start(title: string, initialMessage?: string): Promise<void>;
report(percentage?: number, message?: string): Promise<void>;
end(message?: string): Promise<void>;
}
/**
* A short hand for handling progress reporting to the language client.
*
* It handles all the LSP protocol details for you.
*
* @example
* const progress = Progress.create(connection, capabilities, progressToken);
* await progress.start('Starting progress');
* await progress.report(50, 'Halfway there');
* await progress.end('Finished');
*/
export declare class Progress {
private connection;
private progressToken;
constructor(connection: Connection, progressToken: string);
static create(connection: Connection | undefined, capabilities: ClientCapabilities | undefined, progressToken: string): IProgress;
start(title: string): Promise<void>;
report(percentage?: number, message?: string): Promise<void>;
end(message?: string): Promise<void>;
}
/**
* Given a current/total and an offset, report the percent complete
* @param current - number of items processed from total
* @param total - total number of items
* @param offset - offset % to start at
*
* @example
* const offset = 50 // Start at 50%
* const current = 0
* const total = 100 // files or whatever
* percent(0, total, offset) // 50 %
* percent(50, total, offset) // 75 %
* percent(100, total, offset) // 100 %
*/
export declare function percent(current: number, total: number, offset?: number): number;