|
35 | 35 |
|
36 | 36 | import nextflow.lsp.ast.ASTNodeCache; |
37 | 37 | import nextflow.lsp.file.FileCache; |
38 | | -import nextflow.lsp.file.PathUtils; |
39 | 38 | import nextflow.lsp.util.DebouncingExecutor; |
40 | 39 | import nextflow.lsp.util.LanguageServerUtils; |
41 | 40 | import nextflow.lsp.util.Logger; |
42 | 41 | import nextflow.lsp.util.Positions; |
43 | 42 | import nextflow.script.control.RelatedInformationAware; |
44 | 43 | import nextflow.script.formatter.FormattingOptions; |
| 44 | +import nextflow.util.PathUtils; |
45 | 45 | import org.codehaus.groovy.runtime.DefaultGroovyMethods; |
46 | 46 | import org.eclipse.lsp4j.CallHierarchyIncomingCall; |
47 | 47 | import org.eclipse.lsp4j.CallHierarchyItem; |
@@ -143,23 +143,11 @@ public void initialize(String rootUri, LanguageServerConfiguration configuration |
143 | 143 |
|
144 | 144 | protected Set<URI> getWorkspaceFiles(String rootUri) { |
145 | 145 | try { |
146 | | - var root = Path.of(URI.create(rootUri)); |
147 | 146 | var result = new HashSet<URI>(); |
148 | | - Files.walkFileTree(root, new SimpleFileVisitor<Path>() { |
149 | | - @Override |
150 | | - public FileVisitResult preVisitDirectory(Path path, BasicFileAttributes attrs) { |
151 | | - return PathUtils.isPathExcluded(path, configuration.excludePatterns()) |
152 | | - ? FileVisitResult.SKIP_SUBTREE |
153 | | - : FileVisitResult.CONTINUE; |
154 | | - } |
155 | | - @Override |
156 | | - public FileVisitResult visitFile(Path path, BasicFileAttributes attrs) { |
157 | | - if( matchesFile(path.toString()) && !PathUtils.isPathExcluded(path, configuration.excludePatterns()) ) |
158 | | - result.add(path.toUri()); |
159 | | - return FileVisitResult.CONTINUE; |
160 | | - } |
161 | | - }); |
162 | | - |
| 147 | + PathUtils.visitFiles( |
| 148 | + Path.of(URI.create(rootUri)), |
| 149 | + (path) -> (Files.isDirectory(path) || matchesFile(path.toString())) && !PathUtils.isExcluded(path, configuration.excludePatterns()), |
| 150 | + (path) -> result.add(path.toUri())); |
163 | 151 | return result; |
164 | 152 | } |
165 | 153 | catch( IOException e ) { |
|
0 commit comments