1
1
///ts:ref=globals
2
2
/// <reference path="../../globals.ts"/> ///ts:ref:generated
3
3
4
- ///ts:import=programManager
5
- import programManager = require( '../lang/programManager' ) ; ///ts:import:generated
6
4
///ts:import=atomUtils
7
5
import atomUtils = require( './atomUtils' ) ; ///ts:import:generated
6
+ ///ts:import=parent
7
+ import parent = require( '../../worker/parent' ) ; ///ts:import:generated
8
8
9
9
import path = require( 'path' ) ;
10
10
import fs = require( 'fs' ) ;
@@ -26,8 +26,6 @@ export function attach(editorView: any) {
26
26
return ;
27
27
}
28
28
29
- var program = programManager . getOrCreateProgram ( filePath ) ;
30
-
31
29
var scroll = editorView . find ( '.scroll-view' ) ;
32
30
var subscriber = new Subscriber ( ) ;
33
31
var exprTypeTimeout = null ;
@@ -65,18 +63,19 @@ export function attach(editorView: any) {
65
63
} ;
66
64
exprTypeTooltip = new TooltipView ( tooltipRect ) ;
67
65
66
+ var position = atomUtils . getEditorPositionForBufferPosition ( editor , bufferPt ) ;
68
67
// Actually make the program manager query
69
- var position = atomUtils . getEditorPositionForBufferPosition ( editor , bufferPt ) ;
70
- var info = program . languageService . getQuickInfoAtPosition ( filePath , position ) ;
71
- if ( ! info ) {
72
- hideExpressionType ( ) ;
73
- } else {
74
- var displayName = ts . displayPartsToString ( info . displayParts || [ ] ) ;
75
- var documentation = ts . displayPartsToString ( info . documentation || [ ] ) ;
76
- var message = `<b> ${ displayName } </b>` ;
77
- if ( documentation ) message = message + `<br/><i> ${ documentation } </i>` ;
78
- exprTypeTooltip . updateText ( message ) ;
79
- }
68
+ parent . quickInfo ( { filePath , position } ) . then ( ( resp ) => {
69
+ if ( ! resp . valid ) {
70
+ hideExpressionType ( ) ;
71
+ }
72
+ else {
73
+ var message = `<b> ${ resp . name } </b>` ;
74
+ if ( resp . comment ) message = message + `<br/><i> ${ resp . comment } </i>` ;
75
+ // Sorry about this "if". It's in the code I copied so I guess its there for a reason
76
+ if ( exprTypeTooltip ) exprTypeTooltip . updateText ( message ) ;
77
+ }
78
+ } ) ;
80
79
}
81
80
82
81
0 commit comments