Skip to content

Commit 9bba5bf

Browse files
committed
Additional comments and logging
1 parent cfeba0e commit 9bba5bf

2 files changed

Lines changed: 11 additions & 1 deletion

File tree

src/PowerShellEditorServices/Services/TextDocument/ScriptFile.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,9 @@ public Token[] ScriptTokens
110110

111111
internal ReferenceTable References { get; }
112112

113+
/// <summary>
114+
/// Indicates whether the file is currently open in the editor. PSES may open files for analysis that aren't actually visible in the editor.
115+
/// </summary>
113116
internal bool IsOpen { get; set; }
114117

115118
#endregion

src/PowerShellEditorServices/Services/Workspace/WorkspaceService.cs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,14 @@ public void CloseFile(ScriptFile scriptFile)
302302
Validate.IsNotNull(nameof(scriptFile), scriptFile);
303303

304304
string keyName = GetFileKey(scriptFile.DocumentUri);
305-
workspaceFiles.TryRemove(keyName, out ScriptFile _);
305+
if (workspaceFiles.TryRemove(keyName, out ScriptFile _))
306+
{
307+
logger.LogDebug("Closed file: " + scriptFile.DocumentUri);
308+
}
309+
else
310+
{
311+
logger.LogWarning("Tried to close file that was not open: " + scriptFile.DocumentUri);
312+
}
306313
}
307314

308315
/// <summary>

0 commit comments

Comments
 (0)