File tree Expand file tree Collapse file tree 2 files changed +36
-0
lines changed Expand file tree Collapse file tree 2 files changed +36
-0
lines changed Original file line number Diff line number Diff line change
1
+ "use strict" ;
2
+ var parent = require ( "./worker/parent" ) ;
3
+ var atomUtils = require ( "./main/atom/atomUtils" ) ;
4
+ var immutable_1 = require ( "immutable" ) ;
5
+ var TS_GRAMMARS = immutable_1 . Set ( [ "source.ts" , "source.tsx" ] ) ;
6
+ exports . providerName = "typescript-hyperclick-provider" ;
7
+ exports . wordRegExp = / ( [ A - Z a - z 0 - 9 ] ) + | [ ' " ` ] ( \\ .| [ ^ ' " ` \\ \\ ] ) * [ ' " ` ] / g;
8
+ function getSuggestionForWord ( textEditor , text , range ) {
9
+ return {
10
+ range : range ,
11
+ callback : function ( ) {
12
+ if ( ! TS_GRAMMARS . has ( textEditor . getGrammar ( ) . scopeName ) ) {
13
+ return null ;
14
+ }
15
+ var filePathPosition = {
16
+ filePath : textEditor . getPath ( ) ,
17
+ position : atomUtils . getEditorPositionForBufferPosition ( textEditor , range . start )
18
+ } ;
19
+ parent . getDefinitionsAtPosition ( filePathPosition ) . then ( function ( res ) {
20
+ if ( res . definitions . length > 0 ) {
21
+ var definition = res . definitions [ 0 ] ;
22
+ atom . workspace . open ( definition . filePath , {
23
+ initialLine : definition . position . line ,
24
+ initialColumn : definition . position . col
25
+ } ) ;
26
+ }
27
+ } ) ;
28
+ }
29
+ } ;
30
+ }
31
+ exports . getSuggestionForWord = getSuggestionForWord ;
Original file line number Diff line number Diff line change @@ -196,3 +196,8 @@ function waitForGrammarActivation() {
196
196
} ) ;
197
197
return promise ;
198
198
}
199
+ var hyperclickProvider = require ( "../hyperclickProvider" ) ;
200
+ function getHyperclickProvider ( ) {
201
+ return hyperclickProvider ;
202
+ }
203
+ exports . getHyperclickProvider = getHyperclickProvider ;
You can’t perform that action at this time.
0 commit comments