You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Takes an `editor` and gets the word at current cursor position. If that is nonempty, call
@@ -17,89 +16,79 @@ export function withWord (editor, fn) {
17
16
}
18
17
19
18
/**
20
-
* Gets the word and its range in the `editor`
19
+
* Returns the word and its range in the `editor`.
21
20
*
22
21
* `options`
23
22
* - `bufferPosition` {Point}: If given returns the word at the `bufferPosition`, returns the word at the current cursor otherwise.
24
-
* - `wordRegex` {RegExp} : A RegExp indicating what constitutes a “word”. Will be used if not both `beginWordRegex and `endWordRegex` are passed. (default: `wordRegex`).
25
-
* - `beginWordRegex` {RegExp} : A RegExp to find a beginning of a “word”. Should be passed with `endWordRegex`. (default: `undefined`).
26
-
* - `endWordRegex` {RegExp} : A RegExp to find an end of a “word”. Should be passed with `beginWordRegex`. (default: `undefined`).
23
+
* - `wordRegex` {RegExp} : A RegExp indicating what constitutes a “word” (default: `wordRegex`).
27
24
*/
28
25
exportfunctiongetWordAndRange(editor,options={
29
26
bufferPosition: undefined,
30
-
wordRegex: wordRegex,
31
-
beginWordRegex: undefined,
32
-
endWordRegex: undefined
27
+
wordRegex: wordRegex
33
28
}){
34
29
// @TODO?:
35
30
// The following lines are kinda iffy: The regex may or may not be well chosen
36
31
// and it duplicates the efforts from atom-language-julia.
37
32
// It might be better to select the current word via finding the smallest <span>
38
33
// containing the bufferPosition/cursor which also has `function` or `macro` as its class.
* Returns the range of a word containing the `bufferPosition` in `editor`.
48
46
*
49
47
* `options`
50
-
* - `wordRegex` {RegExp}: A RegExp indicating what constitutes a “word”. Will be used if not both `beginWordRegex and `endWordRegex` are passed. (default: `wordRegex`).
51
-
* - `beginWordRegex` {RegExp} : A RegExp to find a beginning of a “word”. Should be passed with `endWordRegex`. (default: `undefined`).
52
-
* - `endWordRegex` {RegExp} : A RegExp to find an end of a “word”. Should be passed with `beginWordRegex`. (default: `undefined`).
48
+
* - `wordRegex` {RegExp}: A RegExp indicating what constitutes a “word” (default: `wordRegex`).
0 commit comments