Skip to content

Commit 61e57b3

Browse files
fix #1689 (#848)
1 parent 4b39d01 commit 61e57b3

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

src/PowerShellEditorServices/Workspace/Workspace.cs

+2-6
Original file line numberDiff line numberDiff line change
@@ -408,7 +408,6 @@ private void RecursivelyFindReferences(
408408
GetBaseFilePath(
409409
scriptFile.FilePath);
410410

411-
ScriptFile referencedFile;
412411
foreach (string referencedFileName in scriptFile.ReferencedFiles)
413412
{
414413
string resolvedScriptPath =
@@ -429,12 +428,9 @@ private void RecursivelyFindReferences(
429428
referencedFileName,
430429
resolvedScriptPath));
431430

432-
// Make sure file exists before trying to get the file
433-
if (File.Exists(resolvedScriptPath))
431+
// Get the referenced file if it's not already in referencedScriptFiles
432+
if (this.TryGetFile(resolvedScriptPath, out ScriptFile referencedFile))
434433
{
435-
// Get the referenced file if it's not already in referencedScriptFiles
436-
referencedFile = this.GetFile(resolvedScriptPath);
437-
438434
// Normalize the resolved script path and add it to the
439435
// referenced files list if it isn't there already
440436
resolvedScriptPath = resolvedScriptPath.ToLower();

0 commit comments

Comments
 (0)