@@ -47,7 +47,7 @@ type snapshot struct {
47
47
// GetLineMap implements ls.Host.
48
48
func (s * snapshot ) GetLineMap (fileName string ) * ls.LineMap {
49
49
file := s .program .GetSourceFile (fileName )
50
- scriptInfo := s .project .host .GetScriptInfoByPath (file .Path ())
50
+ scriptInfo := s .project .host .DocumentStore (). GetScriptInfoByPath (file .Path ())
51
51
if s .project .getFileVersion (file ) == scriptInfo .Version () {
52
52
return scriptInfo .LineMap ()
53
53
}
@@ -80,11 +80,8 @@ type ProjectHost interface {
80
80
NewLine () string
81
81
DefaultLibraryPath () string
82
82
TypingsInstaller () * TypingsInstaller
83
- DocumentRegistry () * DocumentRegistry
83
+ DocumentStore () * DocumentStore
84
84
ConfigFileRegistry () * ConfigFileRegistry
85
- GetScriptInfoByPath (path tspath.Path ) * ScriptInfo
86
- GetOrCreateScriptInfoForFile (fileName string , path tspath.Path , scriptKind core.ScriptKind ) * ScriptInfo
87
- OnDiscoveredSymlink (info * ScriptInfo )
88
85
Log (s string )
89
86
PositionEncoding () lsproto.PositionEncodingKind
90
87
@@ -280,7 +277,7 @@ func (p *Project) GetSourceFile(opts ast.SourceFileParseOptions) *ast.SourceFile
280
277
if p .program != nil {
281
278
oldSourceFile = p .program .GetSourceFileByPath (scriptInfo .path )
282
279
}
283
- return p .host .DocumentRegistry () .AcquireDocument (scriptInfo , opts , oldSourceFile )
280
+ return p .host .DocumentStore (). documentRegistry .AcquireDocument (scriptInfo , opts , oldSourceFile )
284
281
}
285
282
return nil
286
283
}
@@ -418,7 +415,7 @@ func (p *Project) onWatchEventForNilScriptInfo(fileName string) {
418
415
}
419
416
420
417
func (p * Project ) getOrCreateScriptInfoAndAttachToProject (fileName string , scriptKind core.ScriptKind ) * ScriptInfo {
421
- if scriptInfo := p .host .GetOrCreateScriptInfoForFile ( fileName , p .toPath (fileName ), scriptKind ); scriptInfo != nil {
418
+ if scriptInfo := p .host .DocumentStore (). getOrCreateScriptInfoWorker ( fileName , p .toPath (fileName ), scriptKind , false , "" , false , p . host . FS () ); scriptInfo != nil {
422
419
scriptInfo .attachToProject (p )
423
420
return scriptInfo
424
421
}
@@ -519,7 +516,7 @@ func (p *Project) updateGraph() (*compiler.Program, bool) {
519
516
if oldProgram != nil {
520
517
for _ , oldSourceFile := range oldProgram .GetSourceFiles () {
521
518
if p .program .GetSourceFileByPath (oldSourceFile .Path ()) == nil {
522
- p .host .DocumentRegistry () .ReleaseDocument (oldSourceFile )
519
+ p .host .DocumentStore (). documentRegistry .ReleaseDocument (oldSourceFile )
523
520
p .detachScriptInfoIfNotInferredRoot (oldSourceFile .Path ())
524
521
}
525
522
}
@@ -1017,7 +1014,7 @@ func (p *Project) print(writeFileNames bool, writeFileExplanation bool, writeFil
1017
1014
}
1018
1015
1019
1016
func (p * Project ) getFileVersion (file * ast.SourceFile ) int {
1020
- return p .host .DocumentRegistry () .getFileVersion (file )
1017
+ return p .host .DocumentStore (). documentRegistry .getFileVersion (file )
1021
1018
}
1022
1019
1023
1020
func (p * Project ) Log (s string ) {
@@ -1031,7 +1028,7 @@ func (p *Project) Logf(format string, args ...interface{}) {
1031
1028
func (p * Project ) detachScriptInfoIfNotInferredRoot (path tspath.Path ) {
1032
1029
// We might not find the script info in case its not associated with the project any more
1033
1030
// and project graph was not updated (eg delayed update graph in case of files changed/deleted on the disk)
1034
- if scriptInfo := p .host .GetScriptInfoByPath (path ); scriptInfo != nil &&
1031
+ if scriptInfo := p .host .DocumentStore (). GetScriptInfoByPath (path ); scriptInfo != nil &&
1035
1032
(p .kind != KindInferred || ! p .isRoot (scriptInfo )) {
1036
1033
scriptInfo .detachFromProject (p )
1037
1034
}
@@ -1043,7 +1040,7 @@ func (p *Project) Close() {
1043
1040
1044
1041
if p .program != nil {
1045
1042
for _ , sourceFile := range p .program .GetSourceFiles () {
1046
- p .host .DocumentRegistry () .ReleaseDocument (sourceFile )
1043
+ p .host .DocumentStore (). documentRegistry .ReleaseDocument (sourceFile )
1047
1044
// Detach script info if its not root or is root of non inferred project
1048
1045
p .detachScriptInfoIfNotInferredRoot (sourceFile .Path ())
1049
1046
}
@@ -1059,7 +1056,7 @@ func (p *Project) Close() {
1059
1056
if p .kind == KindInferred {
1060
1057
// Release root script infos for inferred projects.
1061
1058
for path := range p .rootFileNames .Keys () {
1062
- if info := p .host .GetScriptInfoByPath (path ); info != nil {
1059
+ if info := p .host .DocumentStore (). GetScriptInfoByPath (path ); info != nil {
1063
1060
info .detachFromProject (p )
1064
1061
}
1065
1062
}
0 commit comments