@@ -7,7 +7,12 @@ import { CompositeDisposable, Range } from 'atom'
77import { client } from '../connection'
88import modules from './modules'
99import { 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'
1116import { getLocalContext } from '../misc/blocks'
1217
1318const {
@@ -34,11 +39,15 @@ class Goto {
3439 }
3540
3641 getJumpFilePath ( editor , bufferPosition ) {
37- const includeRange = getWordRangeAtBufferPosition ( editor , bufferPosition , includeRegex )
42+ const includeRange = getWordRangeAtBufferPosition ( editor , bufferPosition , {
43+ wordRegex : includeRegex
44+ } )
3845 if ( includeRange . isEmpty ( ) ) return false
3946
4047 // 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+ } )
4251 if ( filePathRange . isEmpty ( ) ) return false
4352
4453 const filePathText = editor . getTextInBufferRange ( filePathRange )
@@ -71,8 +80,17 @@ class Goto {
7180
7281 if ( ! this . isClientAndInkReady ( ) ) return
7382
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
7694
7795 // local context
7896 const { column, row } = bufferPosition
@@ -85,6 +103,7 @@ class Goto {
85103
86104 gotoSymbol ( {
87105 word,
106+ fullWord,
88107 path : editor . getPath ( ) ,
89108 // local context
90109 column : column + 1 ,
@@ -123,12 +142,20 @@ class Goto {
123142 // If Julia is not running, do nothing
124143 if ( ! this . isClientAndInkReady ( ) ) return
125144
126- const { word, range } = getWord ( textEditor , bufferPosition )
127-
128145 // If the scope at `bufferPosition` is not valid code scope, do nothing
129146 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
132159
133160 // local context
134161 const { column, row } = bufferPosition
@@ -139,9 +166,10 @@ class Goto {
139166 const mod = main ? ( sub ? `${ main } .${ sub } ` : main ) : 'Main'
140167 const text = textEditor . getText ( ) // buffer text that will be used for fallback entry
141168
142- return new Promise ( ( resolve , reject ) => {
169+ return new Promise ( ( resolve ) => {
143170 gotoSymbol ( {
144171 word,
172+ fullWord,
145173 path : textEditor . getPath ( ) ,
146174 // local context
147175 column : column + 1 ,
@@ -161,7 +189,7 @@ class Goto {
161189 } )
162190 }
163191 resolve ( {
164- range,
192+ range : results . local ? fullRange : range ,
165193 callback : ( ) => {
166194 setTimeout ( ( ) => {
167195 this . ink . goto . goto ( results , {
0 commit comments