Skip to content

Commit 29ae10f

Browse files
CopilotJustinGrote
andauthored
Use IsInMemory for workspace document saved state
Agent-Logs-Url: https://github.com/PowerShell/PowerShellEditorServices/sessions/b2f2d9b7-95c7-413b-8a23-7845a964c98a Co-authored-by: JustinGrote <15258962+JustinGrote@users.noreply.github.com>
1 parent b781fd1 commit 29ae10f

3 files changed

Lines changed: 1 addition & 9 deletions

File tree

src/PowerShellEditorServices/Services/Extension/EditorOperationsService.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ public async Task SaveFileAsync(string currentPath, string newSavePath)
200200

201201
public WorkspaceOpenDocument[] GetWorkspaceOpenDocuments()
202202
=> _workspaceService.GetOpenedFiles()
203-
.Select(static scriptFile => new WorkspaceOpenDocument(scriptFile.FilePath, scriptFile.IsSaved))
203+
.Select(static scriptFile => new WorkspaceOpenDocument(scriptFile.FilePath, !scriptFile.IsInMemory))
204204
.ToArray();
205205

206206
public string GetWorkspaceRelativePath(ScriptFile scriptFile) => _workspaceService.GetRelativePath(scriptFile);

src/PowerShellEditorServices/Services/TextDocument/Handlers/TextDocumentHandler.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,6 @@ public override async Task<Unit> Handle(DidSaveTextDocumentParams notification,
137137
await _remoteFileManagerService.SaveRemoteFileAsync(savedFile.FilePath).ConfigureAwait(false);
138138
}
139139

140-
savedFile.IsSaved = true;
141140
}
142141
return Unit.Value;
143142
}

src/PowerShellEditorServices/Services/TextDocument/ScriptFile.cs

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -55,11 +55,6 @@ internal sealed class ScriptFile
5555
/// </summary>
5656
public bool IsInMemory { get; }
5757

58-
/// <summary>
59-
/// Gets or sets whether this file has no unsaved changes.
60-
/// </summary>
61-
public bool IsSaved { get; internal set; }
62-
6358
/// <summary>
6459
/// Gets a string containing the full contents of the file.
6560
/// </summary>
@@ -142,7 +137,6 @@ internal ScriptFile(
142137

143138
// SetFileContents() calls ParseFileContents() which initializes the rest of the properties.
144139
SetFileContents(textReader.ReadToEnd());
145-
IsSaved = !IsInMemory;
146140
References = new ReferenceTable(this);
147141
}
148142

@@ -370,7 +364,6 @@ public void ApplyChange(FileChange fileChange)
370364

371365
// Parse the script again to be up-to-date
372366
ParseFileContents();
373-
IsSaved = false;
374367
References.TagAsChanged();
375368
}
376369

0 commit comments

Comments
 (0)