@@ -47,7 +47,7 @@ type snapshot struct {
4747// GetLineMap implements ls.Host.
4848func (s * snapshot ) GetLineMap (fileName string ) * ls.LineMap {
4949 file := s .program .GetSourceFile (fileName )
50- scriptInfo := s .project .host .GetScriptInfoByPath (file .Path ())
50+ scriptInfo := s .project .host .DocumentStore (). GetScriptInfoByPath (file .Path ())
5151 if s .project .getFileVersion (file ) == scriptInfo .Version () {
5252 return scriptInfo .LineMap ()
5353 }
@@ -80,11 +80,8 @@ type ProjectHost interface {
8080 NewLine () string
8181 DefaultLibraryPath () string
8282 TypingsInstaller () * TypingsInstaller
83- DocumentRegistry () * DocumentRegistry
83+ DocumentStore () * DocumentStore
8484 ConfigFileRegistry () * ConfigFileRegistry
85- GetScriptInfoByPath (path tspath.Path ) * ScriptInfo
86- GetOrCreateScriptInfoForFile (fileName string , path tspath.Path , scriptKind core.ScriptKind ) * ScriptInfo
87- OnDiscoveredSymlink (info * ScriptInfo )
8885 Log (s string )
8986 PositionEncoding () lsproto.PositionEncodingKind
9087
@@ -280,7 +277,7 @@ func (p *Project) GetSourceFile(opts ast.SourceFileParseOptions) *ast.SourceFile
280277 if p .program != nil {
281278 oldSourceFile = p .program .GetSourceFileByPath (scriptInfo .path )
282279 }
283- return p .host .DocumentRegistry () .AcquireDocument (scriptInfo , opts , oldSourceFile )
280+ return p .host .DocumentStore (). documentRegistry .AcquireDocument (scriptInfo , opts , oldSourceFile )
284281 }
285282 return nil
286283}
@@ -418,7 +415,7 @@ func (p *Project) onWatchEventForNilScriptInfo(fileName string) {
418415}
419416
420417func (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 {
422419 scriptInfo .attachToProject (p )
423420 return scriptInfo
424421 }
@@ -519,7 +516,7 @@ func (p *Project) updateGraph() (*compiler.Program, bool) {
519516 if oldProgram != nil {
520517 for _ , oldSourceFile := range oldProgram .GetSourceFiles () {
521518 if p .program .GetSourceFileByPath (oldSourceFile .Path ()) == nil {
522- p .host .DocumentRegistry () .ReleaseDocument (oldSourceFile )
519+ p .host .DocumentStore (). documentRegistry .ReleaseDocument (oldSourceFile )
523520 p .detachScriptInfoIfNotInferredRoot (oldSourceFile .Path ())
524521 }
525522 }
@@ -1017,7 +1014,7 @@ func (p *Project) print(writeFileNames bool, writeFileExplanation bool, writeFil
10171014}
10181015
10191016func (p * Project ) getFileVersion (file * ast.SourceFile ) int {
1020- return p .host .DocumentRegistry () .getFileVersion (file )
1017+ return p .host .DocumentStore (). documentRegistry .getFileVersion (file )
10211018}
10221019
10231020func (p * Project ) Log (s string ) {
@@ -1031,7 +1028,7 @@ func (p *Project) Logf(format string, args ...interface{}) {
10311028func (p * Project ) detachScriptInfoIfNotInferredRoot (path tspath.Path ) {
10321029 // We might not find the script info in case its not associated with the project any more
10331030 // 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 &&
10351032 (p .kind != KindInferred || ! p .isRoot (scriptInfo )) {
10361033 scriptInfo .detachFromProject (p )
10371034 }
@@ -1043,7 +1040,7 @@ func (p *Project) Close() {
10431040
10441041 if p .program != nil {
10451042 for _ , sourceFile := range p .program .GetSourceFiles () {
1046- p .host .DocumentRegistry () .ReleaseDocument (sourceFile )
1043+ p .host .DocumentStore (). documentRegistry .ReleaseDocument (sourceFile )
10471044 // Detach script info if its not root or is root of non inferred project
10481045 p .detachScriptInfoIfNotInferredRoot (sourceFile .Path ())
10491046 }
@@ -1059,7 +1056,7 @@ func (p *Project) Close() {
10591056 if p .kind == KindInferred {
10601057 // Release root script infos for inferred projects.
10611058 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 {
10631060 info .detachFromProject (p )
10641061 }
10651062 }
0 commit comments