forked from DonJayamanne/pythonVSCode
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
/
Copy pathextensions.d.ts
46 lines (42 loc) · 1.69 KB
/
extensions.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
/**
* @typedef {Object} SplitLinesOptions
* @property {boolean} [trim=true] - Whether to trim the lines.
* @property {boolean} [removeEmptyEntries=true] - Whether to remove empty entries.
*/
// https://stackoverflow.com/questions/39877156/how-to-extend-string-prototype-and-use-it-next-in-typescript
declare interface String {
/**
* Split a string using the cr and lf characters and return them as an array.
* By default lines are trimmed and empty lines are removed.
* @param {SplitLinesOptions=} splitOptions - Options used for splitting the string.
*/
splitLines(splitOptions?: { trim: boolean; removeEmptyEntries?: boolean }): string[];
/**
* Appropriately formats a string so it can be used as an argument for a command in a shell.
* E.g. if an argument contains a space, then it will be enclosed within double quotes.
*/
toCommandArgumentForPythonExt(): string;
/**
* Appropriately formats a a file path so it can be used as an argument for a command in a shell.
* E.g. if an argument contains a space, then it will be enclosed within double quotes.
*/
fileToCommandArgumentForPythonExt(): string;
/**
* String.format() implementation.
* Tokens such as {0}, {1} will be replaced with corresponding positional arguments.
*/
format(...args: string[]): string;
/**
* String.trimQuotes implementation
* Removes leading and trailing quotes from a string
*/
trimQuotes(): string;
}
declare interface Promise<T> {
/**
* Catches task errors and ignores them.
*/
ignoreErrors(): Promise<void>;
}