@@ -7,7 +7,12 @@ import { CompositeDisposable, Range } from 'atom'
7
7
import { client } from '../connection'
8
8
import modules from './modules'
9
9
import { isValidScopeToInspect } from '../misc/scopes'
10
- import { getWord , getWordRangeAtBufferPosition , isValidWordToInspect } from '../misc/words'
10
+ import {
11
+ wordRegexWithoutDotAccessor ,
12
+ getWordAndRange ,
13
+ getWordRangeAtBufferPosition ,
14
+ isValidWordToInspect
15
+ } from '../misc/words'
11
16
import { getLocalContext } from '../misc/blocks'
12
17
13
18
const {
@@ -34,11 +39,15 @@ class Goto {
34
39
}
35
40
36
41
getJumpFilePath ( editor , bufferPosition ) {
37
- const includeRange = getWordRangeAtBufferPosition ( editor , bufferPosition , includeRegex )
42
+ const includeRange = getWordRangeAtBufferPosition ( editor , bufferPosition , {
43
+ wordRegex : includeRegex
44
+ } )
38
45
if ( includeRange . isEmpty ( ) ) return false
39
46
40
47
// return if the bufferPosition is not on the path string
41
- const filePathRange = getWordRangeAtBufferPosition ( editor , bufferPosition , filePathRegex )
48
+ const filePathRange = getWordRangeAtBufferPosition ( editor , bufferPosition , {
49
+ wordRegex : filePathRegex
50
+ } )
42
51
if ( filePathRange . isEmpty ( ) ) return false
43
52
44
53
const filePathText = editor . getTextInBufferRange ( filePathRange )
@@ -71,8 +80,17 @@ class Goto {
71
80
72
81
if ( ! this . isClientAndInkReady ( ) ) return
73
82
74
- const { word } = getWord ( editor , bufferPosition )
75
- if ( ! isValidWordToInspect ( word ) ) return
83
+ // get word w/ w/o dots at the buffer position
84
+ const { word } = getWordAndRange ( editor , {
85
+ bufferPosition,
86
+ wordRegex : wordRegexWithoutDotAccessor
87
+ } )
88
+ const { word : fullWord } = getWordAndRange ( editor , {
89
+ bufferPosition
90
+ } )
91
+
92
+ // check the validity of code to be inspected
93
+ if ( ! ( isValidWordToInspect ( word ) && isValidWordToInspect ( fullWord ) ) ) return
76
94
77
95
// local context
78
96
const { column, row } = bufferPosition
@@ -85,6 +103,7 @@ class Goto {
85
103
86
104
gotoSymbol ( {
87
105
word,
106
+ fullWord,
88
107
path : editor . getPath ( ) ,
89
108
// local context
90
109
column : column + 1 ,
@@ -123,12 +142,20 @@ class Goto {
123
142
// If Julia is not running, do nothing
124
143
if ( ! this . isClientAndInkReady ( ) ) return
125
144
126
- const { word, range } = getWord ( textEditor , bufferPosition )
127
-
128
145
// If the scope at `bufferPosition` is not valid code scope, do nothing
129
146
if ( ! isValidScopeToInspect ( textEditor , bufferPosition ) ) return
130
- // Check the validity of code to be inspected
131
- if ( ! isValidWordToInspect ( word ) ) return
147
+
148
+ // get word w/ w/o dots at the buffer position
149
+ const { word, range } = getWordAndRange ( textEditor , {
150
+ bufferPosition,
151
+ wordRegex : wordRegexWithoutDotAccessor
152
+ } )
153
+ const { word : fullWord , range : fullRange } = getWordAndRange ( textEditor , {
154
+ bufferPosition
155
+ } )
156
+
157
+ // check the validity of code to be inspected
158
+ if ( ! ( isValidWordToInspect ( word ) && isValidWordToInspect ( fullWord ) ) ) return
132
159
133
160
// local context
134
161
const { column, row } = bufferPosition
@@ -139,9 +166,10 @@ class Goto {
139
166
const mod = main ? ( sub ? `${ main } .${ sub } ` : main ) : 'Main'
140
167
const text = textEditor . getText ( ) // buffer text that will be used for fallback entry
141
168
142
- return new Promise ( ( resolve , reject ) => {
169
+ return new Promise ( ( resolve ) => {
143
170
gotoSymbol ( {
144
171
word,
172
+ fullWord,
145
173
path : textEditor . getPath ( ) ,
146
174
// local context
147
175
column : column + 1 ,
@@ -161,7 +189,7 @@ class Goto {
161
189
} )
162
190
}
163
191
resolve ( {
164
- range,
192
+ range : results . local ? fullRange : range ,
165
193
callback : ( ) => {
166
194
setTimeout ( ( ) => {
167
195
this . ink . goto . goto ( results , {
0 commit comments