Refactor search in files/iterative file processing

* Introduce abstractions: FileCollection, FileProxy
* Unify handling of pattern search in project files
  (source code vs. all files)

This prepares for processing of external files,
which can implement FileProxy differently.
This commit is contained in:
Dominik Jain authored and Dominik Jain committed 2026-07-01 14:32:37 +02:00
1 parent 103a17072e
commit 6e518b5f7c
9 files changed
+179 -113

No files matched your search

@@ -115,7 +115,7 @@ class TestElixirProject:
"""Test comprehensive symbol search across the entire project."""
# Search for all function definitions
function_pattern = r"def\s+\w+\s*[\(\s]"
function_matches = project.search_source_files_for_pattern(function_pattern)
function_matches = project.search_project_files_for_pattern(function_pattern)
# Should find functions across multiple files
if function_matches:
@@ -131,7 +131,7 @@ class TestElixirProject:
# Search for struct definitions
struct_pattern = r"defstruct\s+\["
struct_matches = project.search_source_files_for_pattern(struct_pattern)
struct_matches = project.search_project_files_for_pattern(struct_pattern)
if struct_matches:
# Should find structs primarily in models.ex
@@ -143,7 +143,7 @@ class TestElixirProject:
"""Test that the language server understands Elixir protocols and implementations."""
# Search for protocol definitions
protocol_pattern = r"defprotocol\s+\w+"
protocol_matches = project.search_source_files_for_pattern(protocol_pattern, paths_include_glob="**/models.ex")
protocol_matches = project.search_project_files_for_pattern(protocol_pattern, paths_include_glob="**/models.ex")
if protocol_matches:
# Should find the Serializable protocol
@@ -152,7 +152,7 @@ class TestElixirProject:
# Search for protocol implementations
impl_pattern = r"defimpl\s+\w+"
impl_matches = project.search_source_files_for_pattern(impl_pattern, paths_include_glob="**/models.ex")
impl_matches = project.search_project_files_for_pattern(impl_pattern, paths_include_glob="**/models.ex")
if impl_matches:
# Should find multiple implementations