Skip to content
This repository was archived by the owner on Mar 21, 2025. It is now read-only.

Commit 95c04bc

Browse files
committed
Remove WorkspaceDocument.IsCurrent.
This was a rather poor API that wasn't particularly helpful for users as it's inherently racey.
1 parent d9da56b commit 95c04bc

File tree

2 files changed

+1
-27
lines changed

2 files changed

+1
-27
lines changed

src/language/tooling/Workspaces/Workspace.cs

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,6 @@ internal void AddOrEditDocument(string path)
7878

7979
Documents = Documents.SetItem(path, editedOldDoc);
8080

81-
oldDoc.IsCurrent = false;
82-
8381
_documentEdited.Raise(oldDoc, editedOldDoc);
8482
}
8583

@@ -103,8 +101,6 @@ internal void MoveDocument(string oldPath, string newPath)
103101

104102
Documents = Documents.Remove(oldPath).Add(newPath, movedOldDoc);
105103

106-
oldDoc.IsCurrent = false;
107-
108104
_documentRenamed.Raise(oldDoc, movedOldDoc);
109105

110106
break;
@@ -116,8 +112,6 @@ internal void MoveDocument(string oldPath, string newPath)
116112

117113
Documents = Documents.SetItem(newPath, editedNewDoc);
118114

119-
newDoc.IsCurrent = false;
120-
121115
_documentEdited.Raise(newDoc, editedNewDoc);
122116

123117
break;
@@ -130,9 +124,6 @@ internal void MoveDocument(string oldPath, string newPath)
130124

131125
Documents = Documents.SetItem(oldPath, editedOldDoc).SetItem(newPath, editedNewDoc);
132126

133-
oldDoc.IsCurrent = false;
134-
newDoc.IsCurrent = false;
135-
136127
_documentEdited.Raise(oldDoc, editedOldDoc);
137128
_documentEdited.Raise(newDoc, editedNewDoc);
138129

@@ -148,18 +139,11 @@ internal void DeleteDocument(string path)
148139

149140
Documents = Documents.Remove(path);
150141

151-
doc.IsCurrent = false;
152-
153142
_documentRemoved.Raise(doc);
154143
}
155144

156145
internal void ClearDocuments()
157146
{
158-
var docs = Documents;
159-
160-
Documents = ImmutableDictionary<string, WorkspaceDocument>.Empty;
161-
162-
foreach (var (_, doc) in docs)
163-
doc.IsCurrent = false;
147+
Documents = Documents.Clear();
164148
}
165149
}

src/language/tooling/Workspaces/WorkspaceDocument.cs

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,6 @@ public sealed class WorkspaceDocument
1818
var path => Unsafe.As<string>(path),
1919
};
2020

21-
public bool IsCurrent
22-
{
23-
get => _current;
24-
internal set => _current = value;
25-
}
26-
27-
private volatile bool _current = true;
28-
2921
// This starts out as a string (path). As callers access text, syntax, and semantic information, it gets promoted to
3022
// SourceText, SyntaxTree, and SemanticTree, respectively. SemanticTree links back to SyntaxTree which in turn
3123
// soft-links back to SourceText. The SourceText can always be reconstructed from the SyntaxTree (and by extension
@@ -49,8 +41,6 @@ internal WorkspaceDocument(Workspace workspace, WorkspaceDocumentAttributes attr
4941

5042
public ValueTask<SourceText> GetTextAsync(CancellationToken cancellationToken = default)
5143
{
52-
Check.Operation((_state, IsCurrent) is not (string, false));
53-
5444
return GetTextAsync();
5545

5646
[AsyncMethodBuilder(typeof(PoolingAsyncValueTaskMethodBuilder<>))]

0 commit comments

Comments
 (0)