Skip to content

Commit 0004c47

Browse files
daviwilKayla Davis
authored andcommitted
Fix OpenFileRequest not checking for open files
1 parent a9f974c commit 0004c47

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/PowerShellEditorServices.Transport.Stdio/Request/OpenFileRequest.cs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,14 @@ public override void ProcessMessage(
2626
EditorSession editorSession,
2727
MessageWriter messageWriter)
2828
{
29-
// Open the file in the current session
30-
editorSession.Workspace.OpenFile(this.Arguments.File);
29+
ScriptFile scriptFile = null;
30+
31+
// Only load the file if it isn't loaded already
32+
if (!editorSession.Workspace.TryGetFile(this.Arguments.File, out scriptFile))
33+
{
34+
// Open the file in the current session
35+
editorSession.Workspace.OpenFile(this.Arguments.File);
36+
}
3137
}
3238
}
3339
}

0 commit comments

Comments
 (0)