Skip to content

fix references crash #826

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Dec 18, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions src/PowerShellEditorServices/Language/LanguageService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -330,22 +330,22 @@ public async Task<FindReferencesResult> FindReferencesOfSymbol(
? new OrderedDictionary()
: new OrderedDictionary(StringComparer.OrdinalIgnoreCase);

foreach (ScriptFile file in referencedFiles)
foreach (ScriptFile scriptFile in referencedFiles)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

{
fileMap.Add(file.FilePath, file);
fileMap[scriptFile.FilePath] = scriptFile;
}

foreach (string file in workspace.EnumeratePSFiles())
foreach (string filePath in workspace.EnumeratePSFiles())
{
if (!fileMap.Contains(file))
if (!fileMap.Contains(filePath))
{
if (!workspace.TryGetFile(file, out ScriptFile scriptFile))
if (!workspace.TryGetFile(filePath, out ScriptFile scriptFile))
{
// If we can't access the file for some reason, just ignore it
continue;
}

fileMap.Add(file, scriptFile);
fileMap[filePath] = scriptFile;
}
}

Expand Down