-
Notifications
You must be signed in to change notification settings - Fork 2.6k
feat: standardize tree-sitter test implementations #2960
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: standardize tree-sitter test implementations #2960
Conversation
|
This pull request includes a significant number of changes across multiple files, totaling 4014 lines added and 688 lines removed. While the changes seem to be related to standardizing tree-sitter test implementations, it might be beneficial to consider splitting the work into smaller, more manageable pull requests. This could improve the review process and ensure each set of changes is thoroughly examined. If there are distinct groups of changes that aren't directly related to one another, please consider separating them into different pull requests. Thank you! |
|
|
Generated with ❤️ by ellipsis.dev |
|
This pull request is quite large, with changes across multiple languages and test files. It might be beneficial to split it into smaller, more manageable pull requests. Consider splitting the changes by language or test type, such as grouping all C# test changes together, all JavaScript test changes together, etc. This will make it easier to review and ensure each set of changes is thoroughly tested. |
|
rebased on 3.14.3 |
This commit standardizes the C# Tree-Sitter parser tests to ensure: - Variable/function names in sample code match the tests - Each test only verifies specific identifiers relevant to that test - Test names clearly indicate what they're testing - No skipped tests remain - Only one test exists per structure or combination of structures - All debug output uses debugLog from helpers.ts The standardization improves maintainability and clarity while preserving all existing functionality. Signed-off-by: Eric Wheeler <[email protected]>
This commit standardizes the C Tree-Sitter parser tests to ensure: - Variable/function names in sample code match the tests (using snake_case) - Each test only verifies specific identifiers relevant to that test - Test names clearly indicate what they're testing - No skipped tests remain - tests for unsupported features are removed - Only one test exists per structure or combination of structures - All debug output uses debugLog from helpers.ts The standardization improves maintainability and clarity while preserving all existing functionality. Documentation has been added for C language constructs that are not currently supported by the parser. Signed-off-by: Eric Wheeler <[email protected]>
Standardized Kotlin Tree-Sitter parser to ensure consistent naming and structure: - Renamed identifiers to clearly indicate what they're testing - Ensured all code sections are at least 4 lines long - Organized query patterns logically with clear comments - Removed skipped tests and unused query patterns - Ensured only one test per structure or combination of structures Signed-off-by: Eric Wheeler <[email protected]>
Standardized PHP Tree-Sitter parser to ensure consistent naming and structure: - Renamed identifiers to clearly indicate what they're testing - Ensured all code sections are at least 4 lines long - Organized query patterns logically with clear comments - Consolidated related tests to ensure only one test per structure - Ensured all debug output uses debugLog from helpers.ts Signed-off-by: Eric Wheeler <[email protected]>
Standardized Ruby Tree-Sitter parser to ensure consistent naming and structure: - Expanded query to support many more Ruby language constructs - Added comprehensive test file with clear section headers - Ensured all code sections are at least 4 lines long - Added tests for each language construct - Used consistent naming conventions for test identifiers Signed-off-by: Eric Wheeler <[email protected]>
Standardized Swift Tree-Sitter parser to ensure consistent naming and structure: - Renamed identifiers to clearly indicate what they're testing - Ensured all code sections are at least 4 lines long - Organized query patterns logically with clear comments - Removed skipped tests and unused query patterns - Ensured only one test per structure or combination of structures Signed-off-by: Eric Wheeler <[email protected]>
- Modified esbuild.js to dynamically read and copy all WASM files from tree-sitter-wasms package - Added error handling and logging for better debugging - Ensures all language parsers are automatically included without requiring manual updates
Move test mocks to helpers.ts to be shared between test files Create fixtures directory for shared test data Move sample TSX content to fixtures/sample-tsx.ts Update test files to use shared mocks and fixtures Signed-off-by: Eric Wheeler <[email protected]>
- Remove detailed node inspection to reduce noise - Keep only essential tree structure output - Remove duplicate content logging Signed-off-by: Eric Wheeler <[email protected]>
Move C# sample code to dedicated fixture file and create inspectCSharp test following the same pattern as other language tests. This improves test organization and maintainability by: - Extracting sample C# code to fixtures/sample-c-sharp.ts - Adding inspectCSharp.test.ts for tree structure inspection - Updating parseSourceCodeDefinitions.c-sharp.test.ts to use fixture Signed-off-by: Eric Wheeler <[email protected]>
- Add language parameter to processCaptures for language-specific handling - Implement selective HTML filtering for jsx/tsx files - Update all call sites to pass correct language parameter - Fix type safety by properly passing language strings Signed-off-by: Eric Wheeler <[email protected]>
Move sample code from parseSourceCodeDefinitions test files into dedicated fixtures directory for better organization and reuse: - Created fixtures directory for language samples - Moved sample code for C#, C, JSON, Kotlin, PHP, Ruby, Rust, and Swift - Created inspect test files for each language - Updated original test files to import from fixtures - Standardized test options across languages - No behavior changes, all tests passing Signed-off-by: Eric Wheeler <[email protected]>
Standardize test code structure and naming across all language parsers: - Rename identifiers to clearly indicate test purpose - Ensure each code section has descriptive comments - Group related code sections together - Maintain language-specific naming conventions - Keep test structure consistent across languages - Remove tests for unsupported features Changes made to: - C, JSON, Kotlin, PHP, Ruby, Rust, and Swift test files - Sample code fixtures - Parser definition tests - Inspect structure tests No functional changes - all tests passing with improved maintainability. Signed-off-by: Eric Wheeler <[email protected]>
- Ensure all test structures span at least 4 lines for better parsing - Create exactly one consolidated test per data structure type - Use descriptive names that clearly indicate test purpose - Improve query pattern organization and documentation - Simplify inspect test files to focus on structure validation - Implement result caching in test files for better performance - Remove duplicate and skipped tests - Follow consistent naming conventions across all languages Signed-off-by: Eric Wheeler <[email protected]>
Signed-off-by: Eric Wheeler <[email protected]>
- Move minComponentLines parameter to a file-level constant - Remove parameter passing to processCaptures function - Update all references to use the global constant - Remove redundant local constant declaration in parseFile Signed-off-by: Eric Wheeler <[email protected]>
- Changed MIN_COMPONENT_LINES constant to use getter/setter functions - Updated references to use getMinComponentLines() function - Modified test helper to set value to 0 during tests - This establishes a single source of truth while making testing easier Signed-off-by: Eric Wheeler <[email protected]>
Standardized tree-sitter test implementations across all supported languages: - Removed debugLog calls from test files - Implemented consistent line number pattern matching - Ensured proper test structure and execution order - Added comprehensive test coverage for supported structures - Maintained 1:1 mapping between queries, tests and samples - Documented unsupported features in TODO sections Signed-off-by: Eric Wheeler <[email protected]>
Added TODO sections in test files documenting structures that can be parsed by tree-sitter but currently lack query pattern support: - Python: f-strings, complex type annotations, pattern matching - C++: virtual methods, field initializers, base class clauses - Java: import declarations, field declarations with modifiers - TSX: React hooks, context providers, event handlers Added examples and clarifying comments to existing TODO sections. Enhanced Java query patterns for better structure capture including lambda expressions, field declarations, and type parameters. Signed-off-by: Eric Wheeler <[email protected]>
The copyWasmFiles plugin was using an undefined targetDir variable when copying tree-sitter WASM files. Changed to use the correctly defined distDir variable, fixing the build process. Signed-off-by: Eric Wheeler <[email protected]>
Removed unused imports and variables from tree-sitter test files to fix linting errors: - Removed unused goQuery import from helpers.ts - Removed unused imports and mockedFs variables from language-specific test files - Cleaned up test files to only import what they use Signed-off-by: Eric Wheeler <[email protected]>
|
linted and ready to merge |
|
Generated with ❤️ by ellipsis.dev |
|
and rebased on 3.14.3 |
|
This pull request is quite large, with changes spanning multiple languages and test files. It might be beneficial to split it into smaller, more manageable pull requests. Here are some suggestions on how to split the changes:
By splitting the pull request, it will be easier to review and integrate the changes, ensuring that each set of modifications is thoroughly examined. |
|
The |
let me see if I can reproduce it maybe it is a simple fix |
|
I just told it:
and I cannot reproduce the problem: can you provide additional information so I can figure it out? |
* Detect Ctrl C input when users terminal a long running terminal command * Remove terminal-output-truncation.md documentation file
Context
This PR looks big, but it can't break much. Basically it adds
<list_code_definition_names>support for all tree-sitter supported languages.Additionally, it standardizes tree-sitter test implementations across all supported languages and adds comprehensive test coverage w/ tree-sitter queries for new languages including:
Implementation
Key improvements:
How to Test
Languages
inspectCpp.test.ts
inspectCSharp.test.ts
inspectCSS.test.ts
inspectC.test.ts
inspectElisp.test.ts
inspectElixir.test.ts
inspectEmbeddedTemplate.test.ts
inspectGo.test.ts
inspectHtml.test.ts
inspectJavaScript.test.ts
inspectJava.test.ts
inspectJson.test.ts
inspectKotlin.test.ts
inspectLua.test.ts
inspectOCaml.test.ts
inspectPhp.test.ts
inspectPython.test.ts
inspectRuby.test.ts
inspectRust.test.ts
inspectScala.test.ts
inspectSolidity.test.ts
inspectSwift.test.ts
inspectSystemRDL.test.ts
inspectTLAPlus.test.ts
inspectTOML.test.ts
inspectTsx.test.ts
inspectTypeScript.test.ts
inspectVue.test.ts
inspectZig.test.ts
Get in Touch
Discord: KJ7LNW
Important
Standardizes tree-sitter test implementations across multiple languages, enhancing test coverage and consistency.
fixturesdirectory.__tests__directory.helpers.tsto mock file system and language parser.queriesdirectory for better structure capture.esbuild.jsto dynamically read WASM files instead of using a hardcoded list.This description was created by
for c21e4199827a711ad2d0ddddf3531f503ba07dea. You can customize this summary. It will automatically update as commits are pushed.