1 | import '../../';
|
2 |
|
3 | declare module '../../' {
|
4 | interface DocOrEditor {
|
5 | /**
|
6 | * This method can be used to implement search/replace functionality.
|
7 | * `query`: This can be a regular * expression or a string (only strings will match across lines -
|
8 | * if they contain newlines).
|
9 | * `start`: This provides the starting position of the search. It can be a `{line, ch} object,
|
10 | * or can be left off to default to the start of the document
|
11 | * `caseFold`: This is only relevant when matching a string. IT will cause the search to be case-insenstive
|
12 | */
|
13 | getSearchCursor(query: string | RegExp, start?: Position, caseFold?: boolean): SearchCursor;
|
14 | }
|
15 |
|
16 | interface SearchCursor {
|
17 | /**
|
18 | * Searches forward or backward from the current position. The return value indicates whether a match was
|
19 | * found. If matching a regular expression, the return value will be the array returned by the match method, in case
|
20 | * you want to extract matched groups
|
21 | */
|
22 | find(reverse: boolean): boolean | RegExpMatchArray;
|
23 |
|
24 | /**
|
25 | * Searches forward from the current position. The return value indicates whether a match was
|
26 | * found. If matching a regular expression, the return value will be the array returned by the match method, in case
|
27 | * you want to extract matched groups
|
28 | */
|
29 | findNext(): boolean | RegExpMatchArray;
|
30 |
|
31 | /**
|
32 | * Searches backward from the current position. The return value indicates whether a match was
|
33 | * found. If matching a regular expression, the return value will be the array returned by the match method, in case
|
34 | * you want to extract matched groups
|
35 | */
|
36 | findPrevious(): boolean | RegExpMatchArray;
|
37 |
|
38 | /**
|
39 | * Only valid when the last call to find, findNext, or findPrevious did not return false. Returns {line, ch}
|
40 | * objects pointing the start of the match.
|
41 | */
|
42 | from(): Position;
|
43 |
|
44 | /**
|
45 | * Only valid when the last call to find, findNext, or findPrevious did not return false. Returns {line, ch}
|
46 | * objects pointing the end of the match.
|
47 | */
|
48 | to(): Position;
|
49 |
|
50 | /** Replaces the currently found match with the given text and adjusts the cursor position to reflect the deplacement. */
|
51 | replace(text: string, origin?: string): void;
|
52 | }
|
53 | }
|