Skip to content

Commit 6597555

Browse files
author
Colin Blaise
committed
fix: make EnumeratePSFiles a noop
1 parent 70ef45d commit 6597555

File tree

1 file changed

+1
-51
lines changed

1 file changed

+1
-51
lines changed

src/PowerShellEditorServices/Services/Workspace/WorkspaceService.cs

+1-51
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,8 @@
88
using System.Linq;
99
using System.Security;
1010
using System.Text;
11-
using Microsoft.Extensions.FileSystemGlobbing;
1211
using Microsoft.Extensions.Logging;
1312
using Microsoft.PowerShell.EditorServices.Services.TextDocument;
14-
using Microsoft.PowerShell.EditorServices.Services.Workspace;
1513
using Microsoft.PowerShell.EditorServices.Utility;
1614
using OmniSharp.Extensions.LanguageServer.Protocol;
1715
using OmniSharp.Extensions.LanguageServer.Protocol.Models;
@@ -26,25 +24,6 @@ internal class WorkspaceService
2624
{
2725
#region Private Fields
2826

29-
// List of all file extensions considered PowerShell files in the .Net Core Framework.
30-
private static readonly string[] s_psFileExtensionsCoreFramework =
31-
{
32-
".ps1",
33-
".psm1",
34-
".psd1"
35-
};
36-
37-
// .Net Core doesn't appear to use the same three letter pattern matching rule although the docs
38-
// suggest it should be find the '.ps1xml' files because we search for the pattern '*.ps1'.
39-
// ref https://docs.microsoft.com/en-us/dotnet/api/system.io.directory.getfiles?view=netcore-2.1#System_IO_Directory_GetFiles_System_String_System_String_System_IO_EnumerationOptions_
40-
private static readonly string[] s_psFileExtensionsFullFramework =
41-
{
42-
".ps1",
43-
".psm1",
44-
".psd1",
45-
".ps1xml"
46-
};
47-
4827
// An array of globs which includes everything.
4928
private static readonly string[] s_psIncludeAllGlob = new[]
5029
{
@@ -358,36 +337,7 @@ public IEnumerable<string> EnumeratePSFiles(
358337
string[] excludeGlobs,
359338
string[] includeGlobs,
360339
int maxDepth,
361-
bool ignoreReparsePoints)
362-
{
363-
Matcher matcher = new();
364-
foreach (string pattern in includeGlobs) { matcher.AddInclude(pattern); }
365-
foreach (string pattern in excludeGlobs) { matcher.AddExclude(pattern); }
366-
367-
foreach (string rootPath in WorkspacePaths)
368-
{
369-
if (!Directory.Exists(rootPath))
370-
{
371-
continue;
372-
}
373-
374-
WorkspaceFileSystemWrapperFactory fsFactory = new(
375-
rootPath,
376-
maxDepth,
377-
VersionUtils.IsNetCore ? s_psFileExtensionsCoreFramework : s_psFileExtensionsFullFramework,
378-
ignoreReparsePoints,
379-
logger);
380-
381-
PatternMatchingResult fileMatchResult = matcher.Execute(fsFactory.RootDirectory);
382-
foreach (FilePatternMatch item in fileMatchResult.Files)
383-
{
384-
// item.Path always contains forward slashes in paths when it should be backslashes on Windows.
385-
// Since we're returning strings here, it's important to use the correct directory separator.
386-
string path = VersionUtils.IsWindows ? item.Path.Replace('/', Path.DirectorySeparatorChar) : item.Path;
387-
yield return Path.Combine(rootPath, path);
388-
}
389-
}
390-
}
340+
bool ignoreReparsePoints) => [];
391341

392342
#endregion
393343

0 commit comments

Comments
 (0)