Skip to content

change Enumerate* to Get* #616

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
Jan 25, 2018

Conversation

TylerLeonhardt
Copy link
Member

@TylerLeonhardt TylerLeonhardt commented Jan 22, 2018

As @daviwil mentioned in #612,

If you change those EnumerateDirectories/Files calls to GetDirectories/Files, it might take care of the problem. There's really no benefit to using the Enumerate variety since we're not streaming the results back anyway, it just seemed to be the right thing to do at the time.

He was correct! Changing the Enumerates to Gets did the trick. Verified this on macOS by opening up a big workspace and finding all references/go to definition.

Resolves #612
Resolves PowerShell/vscode-powershell#908
Resolves daviwil/ide-powershell#1

Copy link
Contributor

@daviwil daviwil left a comment

Choose a reason for hiding this comment

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

Thanks for fixing it!

@@ -274,7 +274,7 @@ private IEnumerable<string> RecursivelyEnumerateFiles(string folderPath)
{
foundFiles =
foundFiles.Concat(
Directory.EnumerateFiles(
Directory.GetFiles(
Copy link
Contributor

Choose a reason for hiding this comment

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

While you're at it, can you add the check for PathTooLongException below using a catch exception filter:

catch (Exception ex) when {ex is UnauthorizedException || ex is PathTooLongException) { ... }

You might want to check DirectoryNotFoundException in case someone deletes a dir while we're searching.

@@ -278,10 +278,22 @@ private IEnumerable<string> RecursivelyEnumerateFiles(string folderPath)
folderPath,
pattern));
}
catch (UnauthorizedAccessException e)
catch (DirectoryNotFoundException e)
Copy link
Contributor

Choose a reason for hiding this comment

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

👍

@TylerLeonhardt TylerLeonhardt merged commit 38c1450 into PowerShell:master Jan 25, 2018
@TylerLeonhardt TylerLeonhardt deleted the enumerate-to-get branch January 25, 2018 00:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants