8
8
import programManager = require( './main/lang/programManager' ) ; ///ts:import:generated
9
9
///ts:import=utils
10
10
import utils = require( './main/lang/utils' ) ; ///ts:import:generated
11
+ ///ts:import=parent
12
+ import parent = require( './worker/parent' ) ; ///ts:import:generated
11
13
12
14
import fs = require( 'fs' ) ;
13
15
@@ -28,10 +30,6 @@ interface LinterError {
28
30
linter : string ; // linter name
29
31
}
30
32
31
- var debouncedErrors = utils . debounce ( ( callback : Function , errors : LinterError [ ] ) => {
32
- callback ( errors ) ;
33
- } , 1500 ) ;
34
-
35
33
LinterTslint = ( function ( _super ) {
36
34
__extends ( LinterTslint , _super ) ;
37
35
@@ -41,25 +39,25 @@ LinterTslint = (function(_super) {
41
39
42
40
( < any > LinterTslint ) . syntax = [ 'source.ts' ] ;
43
41
44
- LinterTslint . prototype . lintFile = function ( filePath , callback : ( errors : LinterError [ ] ) => any ) {
42
+ LinterTslint . prototype . lintFile = function ( filePath : string , callback : ( errors : LinterError [ ] ) => any ) {
45
43
// We refuse to work on files that are not on disk.
46
44
if ( ! this . editor . buffer . file
47
45
|| ! this . editor . buffer . file . path
48
46
|| ! fs . existsSync ( this . editor . buffer . file . path ) ) return callback ( [ ] ) ;
49
47
50
48
filePath = this . editor . buffer . file . path ;
51
49
52
- var errors = programManager . getErrorsForFileFiltered ( filePath ) ;
53
- var linterErrors : LinterError [ ] = errors . map ( ( err ) => < LinterError > {
54
- message : err . message ,
55
- line : err . startPos . line + 1 ,
56
- range : new Rng ( [ err . startPos . line , err . startPos . ch ] , [ err . endPos . line , err . endPos . ch ] ) ,
57
- level : 'error' ,
58
- linter : 'TypeScript'
59
- } ) ;
50
+ parent . getErrorsForFile ( { filePath : filePath } ) . then ( ( resp ) => {
51
+ var linterErrors : LinterError [ ] = resp . errors . map ( ( err ) => < LinterError > {
52
+ message : err . message ,
53
+ line : err . startPos . line + 1 ,
54
+ range : new Rng ( [ err . startPos . line , err . startPos . ch ] , [ err . endPos . line , err . endPos . ch ] ) ,
55
+ level : 'error' ,
56
+ linter : 'TypeScript'
57
+ } ) ;
60
58
61
- return callback ( linterErrors ) ;
62
- // return debouncedErrors(callback, linterErrors );
59
+ return callback ( linterErrors ) ;
60
+ } ) ;
63
61
} ;
64
62
65
63
return LinterTslint ;
0 commit comments