atom-languageclient
Version:
Integrate Language Servers with Atom
27 lines (26 loc) • 2.04 kB
TypeScript
import { Point, TextEditor, Range } from "atom";
import { CancellationToken, CancellationTokenSource } from "vscode-jsonrpc";
export declare type ReportBusyWhile = <T>(title: string, f: () => Promise<T>) => Promise<T>;
/** Obtain the range of the word at the given editor position. Uses the non-word characters from the position's grammar scope. */
export declare function getWordAtPosition(editor: TextEditor, position: Point): Range;
export declare function escapeRegExp(string: string): string;
/**
* For the given connection and cancellationTokens map, cancel the existing CancellationToken for that connection then
* create and store a new CancellationToken to be used for the current request.
*/
export declare function cancelAndRefreshCancellationToken<T extends object>(key: T, cancellationTokens: WeakMap<T, CancellationTokenSource>): CancellationToken;
export declare function doWithCancellationToken<T1 extends object, T2>(key: T1, cancellationTokens: WeakMap<T1, CancellationTokenSource>, work: (token: CancellationToken) => Promise<T2>): Promise<T2>;
export declare function assertUnreachable(_: never): never;
export declare function promiseWithTimeout<T>(ms: number, promise: Promise<T>): Promise<T>;
export declare const rootPathDefault: string;
export declare const exeExtentionDefault: string;
/**
* Finds an exe file in the package assuming it is placed under `rootPath/platform-arch/exe`. If the exe file did not
* exist, the given name is returned. For example on Windows x64, if the `exeName` is `serve-d`, it returns the absolute
* path to `./bin/win32-x64/exeName.exe`, and if the file did not exist, `serve-d` is returned.
*
* @param exeName Name of the exe file
* @param rootPath The path of the folder of the exe file. Defaults to 'join("bin", `${process.platform}-${process.arch}`)'
* @param exeExtention The extention of the exe file. Defaults to `process.platform === "win32" ? ".exe" : ""`
*/
export declare function getExePath(exeName: string, rootPath?: string, exeExtention?: string): string;