feat: add Object Pascal language support (server + CLI)#115
Open
siddsghosh wants to merge 2 commits intoSpillwaveSolutions:mainfrom
Open
feat: add Object Pascal language support (server + CLI)#115siddsghosh wants to merge 2 commits intoSpillwaveSolutions:mainfrom
siddsghosh wants to merge 2 commits intoSpillwaveSolutions:mainfrom
Conversation
Adds full AST-aware support for Object Pascal via tree-sitter-language-pack's bundled `pascal` grammar (Isopod/tree-sitter-pascal). Changes: - document_loader.py: register .pas/.pp/.lpr/.dpr extensions → "pascal"; add pascal CONTENT_PATTERNS (unit/program/library header, procedure/function, begin); add extensions to CODE_EXTENSIONS; update LanguageDetector docstring - chunking.py: add "pascal" to lang_map; implement _collect_pascal_symbols() (recursive AST walk) and _pascal_proc_name() (handles both simple and qualified TClass.Method names via genericDot); annotate symbols list type - file_type_presets.py: add "pascal" preset [*.pas *.pp *.lpr *.dpr]; extend "code" union preset with the same four patterns - tests/fixtures/sample.pas: new ~115-line representative Object Pascal unit (TShape/TCircle classes, TPoint record, standalone routines) - tests/unit/test_chunking.py: 5 Pascal tests (init, basic symbol extraction, class/record types, fixture file symbols, async chunking pipeline) - tests/unit/test_document_loader.py: Pascal extension, support, and content detection test classes - tests/test_file_type_presets.py: update preset count to 15; add pascal to code preset coverage check All 783 tests pass; mypy, ruff, black clean; 74% coverage. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Adds 'pascal' preset ["*.pas", "*.pp", "*.lpr", "*.dpr"] to the CLI's FILE_TYPE_PRESETS dict in types.py, keeping it in sync with the server's file_type_presets.py. Also extends the 'code' union preset with the four Pascal extensions. Updates test_types_cli.py: adds "pascal" to the expected preset set and adds test_pascal_preset_patterns to verify all four extensions are present. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Author
|
Added support for Object Pascal for full AST aware context and unit tests. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
tree-sitter-language-pack's bundledpascalgrammar (tree-sitter-language-packis already a dependency)_collect_pascal_symbols+_pascal_proc_name) to correctly resolve both simple names (procedure Foo) and qualified names (procedure TClass.Method) via thegenericDotgrammar node.pas,.pp,.lpr(Lazarus),.dpr(Delphi) →"pascal"unit/program/libraryheader,procedure/function, andbeginpatterns"pascal"file type preset and extends the"code"union preset in both the server (file_type_presets.py) and the CLI (types.py), keeping them in syncsample.pasfixture (TShape/TCircle class hierarchy, TPoint record, standalone routines, ~115 lines)Test plan
test_pascal_code_chunker_initialization— tree-sitter grammar loadstest_pascal_symbol_extraction_basic— standalone procedure/function names extractedtest_pascal_symbol_extraction_class— class/record type names + qualified method names extracted;kindvalues match grammar node namestest_pascal_fixture_file_symbols— all key declarations fromsample.paspresenttest_pascal_code_chunker_chunking— async full pipeline produces chunks with symbol metadataTestPascalExtensionDetection— all four extensions detected correctly (case-insensitive)TestPascalIsSupported— language appears inget_supported_languages()TestPascalContentDetection— unit/program header and procedure/function patterns score highesttest_file_type_presets(server) —"pascal"preset exists;"code"preset includes*.pastest_pascal_preset_patterns(CLI) — all four Pascal extensions present in CLI presettest_all_expected_presets_exist(CLI) —"pascal"included in expected preset settask before-pushequivalent: Black ✓, Ruff ✓, mypy ✓, all tests pass🤖 Generated with Claude Code