Conversation
Amp-Thread-ID: https://ampcode.com/threads/T-019c4392-d1f3-7350-8b01-d25359dc2c81 Co-authored-by: Amp <amp@ampcode.com>
Amp-Thread-ID: https://ampcode.com/threads/T-019c43b4-e154-721f-84f6-fc8d4cc6b915 Co-authored-by: Amp <amp@ampcode.com>
… update plan with AST findings Amp-Thread-ID: https://ampcode.com/threads/T-019c43b4-e154-721f-84f6-fc8d4cc6b915 Co-authored-by: Amp <amp@ampcode.com>
- Create cfg-java.ts with all statement handlers:
- Custom for_statement handler (Java init embeds semicolons)
- Custom switch_expression handler (traditional + arrow cases)
- Custom try/try-with-resources handler (modeled on TypeScript)
- Custom labeled_statement handler (no label field in Java AST)
- Reused common patterns for if, while, do-while, enhanced-for,
break, continue, return, throw
- Register Java in all 8 touch points (cfg.ts, file-parsing.ts,
extension.ts, Demo.svelte x3, App.svelte)
- Create demo.java with representative example code
- Update AGENTS.md with bun platform notes and Java in language list
- Update plan checklist (Steps 5-11 complete)
Amp-Thread-ID: https://ampcode.com/threads/T-019c43c2-b6df-71c8-ad06-117c882ebc30
Co-authored-by: Amp <amp@ampcode.com>
- Create src/test/collect-java.ts: test collector using tree-sitter query to match block_comment + method_declaration pairs inside class bodies, with indentation stripping for comment parsing - Register Java in src/test/commentTestCollector.ts - Create src/test/commentTestSamples/sample.java with 21 test functions covering: if/else, for, enhanced-for, while, do-while, switch, try/catch/finally, labeled statements, throw, and reachability assertions - Add System.exit -> TERMINATE in per-language-call-handlers.ts - Update plan checklist: all 18 steps complete - All 694 tests pass (75 new Java tests), lint clean, build succeeds Amp-Thread-ID: https://ampcode.com/threads/T-019c43d1-7c59-71da-85d7-e61d315b9afd Co-authored-by: Amp <amp@ampcode.com>
Add extended test coverage for Java control-flow features that were missing from the initial implementation: - Arrow-style switch cases (case 1 -> f()) and multi-label arrows - Multiple catch clauses in try statements - Try-with-resources (with and without finally) - Nested try/catch/finally - Return inside try/finally - If without braces - Synchronized blocks (simple and with control flow) - Assert statements - Switch with explicit default Fix three bugs discovered by the new tests: 1. Try handler only captured one catch clause (? -> * quantifier, getSyntax -> getSyntaxMany, loop over all catch blocks) 2. Arrow switch cases crashed collectCases because it assumed ':' separator (switch_rule uses '->' instead). Made colon query optional via tryMatch. 3. synchronized_statement fell to defaultProcessStatement, hiding internal control flow. Added handler that dispatches into body. Also extended BlockMatcher.tryMatch to accept QueryOptions. All 739 tests pass, lint clean, build succeeds. Amp-Thread-ID: https://ampcode.com/threads/T-019c43d9-6368-770f-af17-1bf6b59e38bd Co-authored-by: Amp <amp@ampcode.com>
Amp-Thread-ID: https://ampcode.com/threads/T-019c7772-e868-7254-9566-eedb916ffcbb Co-authored-by: Amp <amp@ampcode.com>
Amp-Thread-ID: https://ampcode.com/threads/T-019c7778-6b7c-77bd-9f1b-98cfb1209678 Co-authored-by: Amp <amp@ampcode.com>
Amp-Thread-ID: https://ampcode.com/threads/T-019c7778-6b7c-77bd-9f1b-98cfb1209678 Co-authored-by: Amp <amp@ampcode.com>
…upport Amp-Thread-ID: https://ampcode.com/threads/T-019c7778-6b7c-77bd-9f1b-98cfb1209678 Co-authored-by: Amp <amp@ampcode.com>
Amp-Thread-ID: https://ampcode.com/threads/T-019c7778-6b7c-77bd-9f1b-98cfb1209678 Co-authored-by: Amp <amp@ampcode.com>
Amp-Thread-ID: https://ampcode.com/threads/T-019c7778-6b7c-77bd-9f1b-98cfb1209678 Co-authored-by: Amp <amp@ampcode.com>
- Fixed C# test expectations based on actual CFG behavior: - SimpleReturn: 1 node (return merges with implicit end) - SimpleThrow: 2 nodes, 1 exit - BreakInLoop: 3 nodes (simplified without markers) - ContinueInLoop: 6 nodes (C# AST structure difference) - Switch1: removed fallthrough reaches (C# requires break) - Updated all Segmentation snapshots - Updated AddCSharpSupport.md with completion status and learnings - All 801 tests pass Amp-Thread-ID: https://ampcode.com/threads/T-019c7778-6b7c-77bd-9f1b-98cfb1209678 Co-authored-by: Amp <amp@ampcode.com>
- Fixed switch_statement handler to use SyntaxNode arrays from getCases() for brace offset linking (matching Java's pattern), instead of incorrectly accessing .syntax on Case objects. - Updated Switch1 Segmentation snapshot for corrected offsets. - All 801 tests pass, bun lint clean. Amp-Thread-ID: https://ampcode.com/threads/T-019c7778-6b7c-77bd-9f1b-98cfb1209678 Co-authored-by: Amp <amp@ampcode.com>
Amp-Thread-ID: https://ampcode.com/threads/T-019c7778-6b7c-77bd-9f1b-98cfb1209678 Co-authored-by: Amp <amp@ampcode.com>
Amp-Thread-ID: https://ampcode.com/threads/T-019c7778-6b7c-77bd-9f1b-98cfb1209678 Co-authored-by: Amp <amp@ampcode.com>
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.
Type of changes
Checklist
bun linton the code.Description
Please describe your changes here. If this fixes a bug, please link to the issue, if possible.