@@ -347,15 +347,16 @@ func (s *Session) Snapshot() (*Snapshot, func()) {
347
347
348
348
func (s * Session ) GetLanguageService (ctx context.Context , uri lsproto.DocumentUri ) (* ls.LanguageService , error ) {
349
349
var snapshot * Snapshot
350
- fileChanges , overlays , ataChanges , updateConfig := s .flushChanges (ctx )
351
- updateSnapshot := ! fileChanges .IsEmpty () || len (ataChanges ) > 0 || updateConfig
350
+ fileChanges , overlays , ataChanges , newConfig := s .flushChanges (ctx )
351
+ updateSnapshot := ! fileChanges .IsEmpty () || len (ataChanges ) > 0 || newConfig != nil
352
352
if updateSnapshot {
353
353
// If there are pending file changes, we need to update the snapshot.
354
354
// Sending the requested URI ensures that the project for this URI is loaded.
355
355
snapshot = s .UpdateSnapshot (ctx , overlays , SnapshotChange {
356
356
reason : UpdateReasonRequestedLanguageServicePendingChanges ,
357
357
fileChanges : fileChanges ,
358
358
ataChanges : ataChanges ,
359
+ newConfig : newConfig ,
359
360
requestedURIs : []lsproto.DocumentUri {uri },
360
361
})
361
362
} else {
@@ -519,7 +520,7 @@ func (s *Session) Close() {
519
520
s .backgroundQueue .Close ()
520
521
}
521
522
522
- func (s * Session ) flushChanges (ctx context.Context ) (FileChangeSummary , map [tspath .Path ]* overlay , map [tspath.Path ]* ATAStateChange , bool ) {
523
+ func (s * Session ) flushChanges (ctx context.Context ) (FileChangeSummary , map [tspath .Path ]* overlay , map [tspath.Path ]* ATAStateChange , * ls. UserPreferences ) {
523
524
s .pendingFileChangesMu .Lock ()
524
525
defer s .pendingFileChangesMu .Unlock ()
525
526
s .pendingATAChangesMu .Lock ()
@@ -528,10 +529,13 @@ func (s *Session) flushChanges(ctx context.Context) (FileChangeSummary, map[tspa
528
529
s .pendingATAChanges = make (map [tspath.Path ]* ATAStateChange )
529
530
fileChanges , overlays := s .flushChangesLocked (ctx )
530
531
s .pendingConfigChangesMu .Lock ()
531
- updateConfig := s .pendingConfigChanges
532
+ var newConfig * ls.UserPreferences
533
+ if s .pendingConfigChanges {
534
+ newConfig = s .userPreferences .Copy ()
535
+ }
532
536
s .pendingConfigChanges = false
533
537
defer s .pendingConfigChangesMu .Unlock ()
534
- return fileChanges , overlays , pendingATAChanges , updateConfig
538
+ return fileChanges , overlays , pendingATAChanges , newConfig
535
539
}
536
540
537
541
// flushChangesLocked should only be called with s.pendingFileChangesMu held.
0 commit comments