mirror of
https://github.com/catlog22/Claude-Code-Workflow.git
synced 2026-02-28 09:23:08 +08:00
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:
@@ -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."""
|
||||
|
||||
Reference in New Issue
Block a user