@@ -8,33 +8,26 @@ import (
8
8
)
9
9
10
10
type LanguageService struct {
11
- host Host
12
- converters * Converters
13
- documentPositionMappers map [string ]* sourcemap.DocumentPositionMapper
14
- useCaseSensitiveFileNames bool
15
- readFile func (path string ) (contents string , ok bool )
16
- fileExists func (path string ) bool
11
+ host Host
12
+ program * compiler.Program
13
+ converters * Converters
14
+ documentPositionMappers map [string ]* sourcemap.DocumentPositionMapper
17
15
}
18
16
19
17
func NewLanguageService (
18
+ program * compiler.Program ,
20
19
host Host ,
21
- converters * Converters ,
22
- readFile func (path string ) (contents string , ok bool ),
23
- fileExists func (path string ) bool ,
24
- useCaseSensitiveFileNames bool ,
25
20
) * LanguageService {
26
21
return & LanguageService {
27
- host : host ,
28
- converters : converters ,
29
- readFile : readFile ,
30
- fileExists : fileExists ,
31
- useCaseSensitiveFileNames : useCaseSensitiveFileNames ,
32
- documentPositionMappers : map [string ]* sourcemap.DocumentPositionMapper {},
22
+ host : host ,
23
+ program : program ,
24
+ converters : host .Converters (),
25
+ documentPositionMappers : map [string ]* sourcemap.DocumentPositionMapper {},
33
26
}
34
27
}
35
28
36
29
func (l * LanguageService ) GetProgram () * compiler.Program {
37
- return l .host . GetProgram ()
30
+ return l .program
38
31
}
39
32
40
33
func (l * LanguageService ) tryGetProgramAndFile (fileName string ) (* compiler.Program , * ast.SourceFile ) {
@@ -62,11 +55,11 @@ func (l *LanguageService) GetDocumentPositionMapper(fileName string) *sourcemap.
62
55
}
63
56
64
57
func (l * LanguageService ) ReadFile (fileName string ) (string , bool ) {
65
- return l .readFile (fileName )
58
+ return l .host . ReadFile (fileName )
66
59
}
67
60
68
61
func (l * LanguageService ) UseCaseSensitiveFileNames () bool {
69
- return l .useCaseSensitiveFileNames
62
+ return l .host . UseCaseSensitiveFileNames ()
70
63
}
71
64
72
65
func (l * LanguageService ) GetLineInfo (fileName string ) * sourcemap.LineInfo {
0 commit comments