feat(codexlens): add staged settings for advanced configuration and update related components

- Added new staged settings in config.py for coarse_k, lsp_depth, stage2_mode, and clustering strategy.
- Updated config-handlers.ts to handle new staged settings and map environment variables.
- Enhanced codexlens.json localization files for English and Chinese to include new staged settings.
- Modified astgrep_js_ts_processor.py to improve import handling for named imports.
- Updated JavaScript and TypeScript patterns to support new import formats.
- Added tests for staged settings loading and performance benchmarks for stage-2 expansion.
This commit is contained in:
catlog22
2026-02-18 13:05:35 +08:00
parent 265a77d6e7
commit d6e282b5a9
12 changed files with 618 additions and 78 deletions

View File

@@ -83,16 +83,27 @@ def test_js_imports_and_inherits_match(tmp_path: Path) -> None:
assert result_ts is not None
assert result_ast is not None
ts_rel = extract_relationship_tuples(
ts_imports = extract_relationship_tuples(
result_ts.relationships,
only_types={RelationshipType.IMPORTS, RelationshipType.INHERITS},
only_types={RelationshipType.IMPORTS},
)
ast_rel = extract_relationship_tuples(
ast_imports = extract_relationship_tuples(
result_ast.relationships,
only_types={RelationshipType.IMPORTS, RelationshipType.INHERITS},
only_types={RelationshipType.IMPORTS},
)
assert ast_imports == ts_imports
assert ast_rel == ts_rel
ts_inherits = extract_relationship_tuples(
result_ts.relationships,
only_types={RelationshipType.INHERITS},
)
ast_inherits = extract_relationship_tuples(
result_ast.relationships,
only_types={RelationshipType.INHERITS},
)
# Ast-grep may include inheritance edges that the tree-sitter extractor does not currently emit.
assert ts_inherits.issubset(ast_inherits)
assert ("Child", "Base", "inherits") in ast_inherits
def test_ts_imports_match_and_inherits_superset(tmp_path: Path) -> None:
@@ -137,4 +148,3 @@ def test_ts_imports_match_and_inherits_superset(tmp_path: Path) -> None:
assert ts_inherits.issubset(ast_inherits)
# But at minimum, class inheritance should be present.
assert ("Child", "Base", "inherits") in ast_inherits