Skip to content

Commit be25a2b

Browse files
authored
Fix race on snapshot in DidOpenFile (microsoft#2723)
1 parent a91dd75 commit be25a2b

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

internal/project/session.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -245,6 +245,8 @@ func (s *Session) InitializeWithUserConfig(config *lsutil.UserConfig) {
245245

246246
func (s *Session) DidOpenFile(ctx context.Context, uri lsproto.DocumentUri, version int32, content string, languageKind lsproto.LanguageKind) {
247247
s.cancelDiagnosticsRefresh()
248+
s.snapshotUpdateMu.Lock()
249+
defer s.snapshotUpdateMu.Unlock()
248250
s.pendingFileChangesMu.Lock()
249251
s.pendingFileChanges = append(s.pendingFileChanges, FileChange{
250252
Kind: FileChangeKindOpen,

0 commit comments

Comments
 (0)