@@ -69,18 +69,11 @@ public TextDocumentState(SolutionServices solutionServices, DocumentInfo info, L
6969 public IReadOnlyList < string > Folders => Attributes . Folders ;
7070 public string Name => Attributes . Name ;
7171
72- private static ITextAndVersionSource CreateStrongText ( TextAndVersion text )
73- => new ConstantTextAndVersionSource ( text ) ;
72+ private static ConstantTextAndVersionSource CreateStrongText ( TextAndVersion text )
73+ => new ( text ) ;
7474
75- private static ITextAndVersionSource CreateRecoverableText ( TextAndVersion text , SolutionServices services )
76- {
77- var service = services . GetRequiredService < IWorkspaceConfigurationService > ( ) ;
78- var options = service . Options ;
79-
80- return options . DisableRecoverableText
81- ? CreateStrongText ( text )
82- : new RecoverableTextAndVersion ( new ConstantTextAndVersionSource ( text ) , services ) ;
83- }
75+ private static RecoverableTextAndVersion CreateRecoverableText ( TextAndVersion text , SolutionServices services )
76+ => new ( new ConstantTextAndVersionSource ( text ) , services ) ;
8477
8578 public ITemporaryStorageTextHandle ? StorageHandle
8679 => ( TextAndVersionSource as RecoverableTextAndVersion ) ? . StorageHandle ;
@@ -144,13 +137,11 @@ public async Task<VersionStamp> GetTextVersionAsync(CancellationToken cancellati
144137 }
145138
146139 public TextDocumentState UpdateText ( TextAndVersion newTextAndVersion , PreservationMode mode )
147- {
148- var newTextSource = mode == PreservationMode . PreserveIdentity
149- ? CreateStrongText ( newTextAndVersion )
150- : CreateRecoverableText ( newTextAndVersion , solutionServices ) ;
151-
152- return UpdateText ( newTextSource , mode , incremental : true ) ;
153- }
140+ => UpdateText ( mode == PreservationMode . PreserveIdentity
141+ ? CreateStrongText ( newTextAndVersion )
142+ : CreateRecoverableText ( newTextAndVersion , solutionServices ) ,
143+ mode ,
144+ incremental : true ) ;
154145
155146 public TextDocumentState UpdateText ( SourceText newText , PreservationMode mode )
156147 {
@@ -170,12 +161,9 @@ public TextDocumentState UpdateText(TextLoader loader, PreservationMode mode)
170161
171162 private static ITextAndVersionSource CreateTextFromLoader ( TextLoader loader , PreservationMode mode , SolutionServices solutionServices )
172163 {
173- var service = solutionServices . GetRequiredService < IWorkspaceConfigurationService > ( ) ;
174- var options = service . Options ;
175-
176164 // If the caller is explicitly stating that identity must be preserved, then we created a source that will load
177165 // from the loader the first time, but then cache that result so that hte same result is *always* returned.
178- if ( mode == PreservationMode . PreserveIdentity || options . DisableRecoverableText )
166+ if ( mode == PreservationMode . PreserveIdentity )
179167 return new LoadableTextAndVersionSource ( loader , cacheResult : true ) ;
180168
181169 // If the loader asks us to always hold onto it strongly, then we do not want to create a recoverable text
0 commit comments