Highlight keywords conservatively#666
Open
nbauma109 wants to merge 19 commits into
Open
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #666 +/- ##
============================================
+ Coverage 80.67% 80.68% +0.01%
- Complexity 7972 8024 +52
============================================
Files 181 181
Lines 30719 30795 +76
Branches 3957 3998 +41
============================================
+ Hits 24783 24848 +65
Misses 4264 4264
- Partials 1672 1683 +11 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
- Fix noPreviousToken() to use passed array parameter consistently
- Remove yield keyword detection after -> (fixes 'case 0 -> yield;')
- Simplify yield detection to only treat as keyword after ':' or '{'
- Add isModuleKeyword() helper supporting annotations (e.g., @deprecated module)
- Update test case from invalid 'case 1 -> yield 42;' to valid 'case 1 -> { yield 42; }'
- Add test for 'case 0 -> yield;' expecting identifier
Agent-Logs-Url: https://github.com/nbauma109/RSyntaxTextArea/sessions/6d7003d5-ef8d-4189-b946-b81cd0e5c2cd
Co-authored-by: nbauma109 <9403560+nbauma109@users.noreply.github.com>
Add isYieldKeywordAtLineStart() helper to handle yield statements at the beginning of lines (common formatting in switch blocks). The heuristic checks what follows yield:
- If followed by an expression/value (not '(', ':', or ';'), treat as keyword
- If followed by ';' or nothing, treat as identifier (ambiguous case)
- This enables correct highlighting of 'yield value;' on its own line in switch blocks
Agent-Logs-Url: https://github.com/nbauma109/RSyntaxTextArea/sessions/ff04e4e0-288e-4aeb-b548-64038033ff91
Co-authored-by: nbauma109 <9403560+nbauma109@users.noreply.github.com>
- Fix noPreviousToken() to check against s.offset instead of 0 (handles non-zero segment offsets on lines after first in documents) - Enhance isYieldKeyword() to recognize yield after ')' and ';' (fixes nested control flow like 'if (b) yield 1;') - Apply fixes to both .java and .flex files for consistency Agent-Logs-Url: https://github.com/nbauma109/RSyntaxTextArea/sessions/8916a861-fc85-40a9-8db6-ec748a717793 Co-authored-by: nbauma109 <9403560+nbauma109@users.noreply.github.com>
- Add findNextNonWhitespaceSkipComments() to skip comments when peeking - Enhance isModuleKeyword() to recognize module after bare annotations (e.g., @deprecated module) - Add nextClassOrInterfaceKeyword() to accept non-adjacent modifiers after sealed - Update sealed/non-sealed detection to handle cases like "sealed abstract class" - Apply all changes to both JavaTokenMaker.java and .flex files 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com> Agent-Logs-Url: https://github.com/nbauma109/RSyntaxTextArea/sessions/d2a92c03-1bdc-41f3-a342-a39dcd06397c Co-authored-by: nbauma109 <9403560+nbauma109@users.noreply.github.com>
…xpr)
- Update isYieldKeywordAtLineStart to use findNextNonWhitespaceSkipComments
- Fix isYieldKeywordAtLineStart to treat 'yield (' as keyword (yield statement)
- Update nextTokenEquals to skip comments when peeking next token
- Update nextTokenStartsIdentifier to skip comments when peeking next token
- Apply all changes to both JavaTokenMaker.java and .flex files
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Agent-Logs-Url: https://github.com/nbauma109/RSyntaxTextArea/sessions/a1b21b5b-8e51-472e-abe0-eeb48a953fe0
Co-authored-by: nbauma109 <9403560+nbauma109@users.noreply.github.com>
- Remove ')' from yield keyword detection to avoid treating yield as keyword after any closing paren (more conservative approach to prevent false positives) - Add annotation skipping in nextClassOrInterfaceKeyword to handle cases like "sealed @deprecated class" - Apply changes to both JavaTokenMaker.java and .flex files 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com> Agent-Logs-Url: https://github.com/nbauma109/RSyntaxTextArea/sessions/d609853f-783c-4e7c-b4fe-eef4b11479e3 Co-authored-by: nbauma109 <9403560+nbauma109@users.noreply.github.com>
- Add findPreviousNonWhitespaceSkipComments to skip comments when checking prefix context - Update noPreviousToken to use comment-skipping version for module detection - Improve restricted keyword detection (exports, record, etc.) to handle line breaks while still recognizing method/field usage - Re-add ')' to yield keyword detection for conditional expressions (if (cond) yield value;) - Apply all changes to both JavaTokenMaker.java and .flex files 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com> Agent-Logs-Url: https://github.com/nbauma109/RSyntaxTextArea/sessions/25ff1bd0-82fe-4c7b-990a-055758419dca Co-authored-by: nbauma109 <9403560+nbauma109@users.noreply.github.com>
Agent-Logs-Url: https://github.com/nbauma109/RSyntaxTextArea/sessions/43702e97-c42d-4fdb-90c4-c021c615ac6b Co-authored-by: nbauma109 <9403560+nbauma109@users.noreply.github.com>
Agent-Logs-Url: https://github.com/nbauma109/RSyntaxTextArea/sessions/23bf6039-a16e-4c25-810b-01ab2a54865b Co-authored-by: nbauma109 <9403560+nbauma109@users.noreply.github.com>
Agent-Logs-Url: https://github.com/nbauma109/RSyntaxTextArea/sessions/f834b1b6-347d-4be7-a575-d918a3c614d1 Co-authored-by: nbauma109 <9403560+nbauma109@users.noreply.github.com>
Agent-Logs-Url: https://github.com/nbauma109/RSyntaxTextArea/sessions/fd50eb05-6ed3-44f3-a0ea-d699cb66fe17 Co-authored-by: nbauma109 <9403560+nbauma109@users.noreply.github.com>
Agent-Logs-Url: https://github.com/nbauma109/RSyntaxTextArea/sessions/ab720ad5-3192-42c8-8551-80a7d99c7aa8 Co-authored-by: nbauma109 <9403560+nbauma109@users.noreply.github.com>
|
@claude[agent] are you OK? |
…on detection Agent-Logs-Url: https://github.com/nbauma109/RSyntaxTextArea/sessions/3f624baf-8728-45af-9b98-9e82bb0be852 Co-authored-by: nbauma109 <9403560+nbauma109@users.noreply.github.com>
Agent-Logs-Url: https://github.com/nbauma109/RSyntaxTextArea/sessions/c19648b6-504d-4197-9fa0-a8ddee806dbe Co-authored-by: nbauma109 <9403560+nbauma109@users.noreply.github.com>
Agent-Logs-Url: https://github.com/nbauma109/RSyntaxTextArea/sessions/dff16ace-6da4-4fd1-acc1-3f5f911291c8 Co-authored-by: nbauma109 <9403560+nbauma109@users.noreply.github.com>
Agent-Logs-Url: https://github.com/nbauma109/RSyntaxTextArea/sessions/65720246-2da3-47e6-8bb0-ca8e9057c990 Co-authored-by: nbauma109 <9403560+nbauma109@users.noreply.github.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.
Fixes #665