feat: add experimental support for AST parsing and static graph indexing

- Introduced CLI options for using AST grep parsers and enabling static graph relationships during indexing.
- Updated configuration management to load new settings for AST parsing and static graph types.
- Enhanced AST grep processor to handle imports with aliases and improve relationship tracking.
- Modified TreeSitter parsers to support synthetic module scopes for better static graph persistence.
- Implemented global relationship updates in the incremental indexer for static graph expansion.
- Added new ArtifactTag and FloatingFileBrowser components to the frontend for improved terminal dashboard functionality.
- Created utility functions for detecting CCW artifacts in terminal output with associated tests.
This commit is contained in:
catlog22
2026-02-15 23:12:06 +08:00
parent 48a6a1f2aa
commit 8938c47f88
39 changed files with 2956 additions and 297 deletions

View File

@@ -377,6 +377,43 @@ class TestParserFactory:
finally:
del os.environ["CODEXLENS_DATA_DIR"]
def test_factory_passes_config_to_treesitter(self, monkeypatch: pytest.MonkeyPatch) -> None:
"""Ensure ParserFactory config is forwarded into TreeSitterSymbolParser."""
from codexlens.entities import IndexedFile
captured: dict = {}
class FakeTreeSitterSymbolParser:
def __init__(self, language_id, path=None, config=None) -> None:
captured["config"] = config
self.language_id = language_id
def is_available(self) -> bool:
return True
def parse(self, text: str, path: Path) -> IndexedFile:
return IndexedFile(
path=str(path.resolve()),
language=self.language_id,
symbols=[],
chunks=[],
relationships=[],
)
monkeypatch.setattr(
"codexlens.parsers.factory.TreeSitterSymbolParser",
FakeTreeSitterSymbolParser,
)
config = Config()
config.use_astgrep = True
factory = ParserFactory(config)
parser = factory.get_parser("python")
parser.parse("def hello():\n pass\n", Path("test.py"))
assert captured.get("config") is config
class TestParserEdgeCases:
"""Edge case tests for parsers."""