Skip to content

feat: check cursor position within CJK substring match on hover#120

Open
aromarious wants to merge 1 commit intodev-cycles:mainfrom
aromarious:feat/cjk-substring-matching
Open

feat: check cursor position within CJK substring match on hover#120
aromarious wants to merge 1 commit intodev-cycles:mainfrom
aromarious:feat/cjk-substring-matching

Conversation

@aromarious
Copy link
Contributor

Summary

  • Hovering anywhere in a CJK token (e.g. 注文が届く) previously showed definitions for all matching substrings regardless of cursor position. Now the hover handler checks that the cursor is within the matched substring's range.
  • Added Lexer.getWithStart to return the token's start column, enabling cursor offset calculation
  • findMatchingTermsBySubstring now filters by cursor position using IndexOf result and key length
  • Non-CJK path is unaffected
  • Added CJKDemo workspace fixture for manual testing

Test plan

  • Language Server unit tests pass (dotnet test --filter "Hover" — 63 passing)
  • Core CJK tests pass (dotnet test --filter "CJK" — 8 passing)
  • E2E positive tests: cursor on or in 注文が届く → shows 注文 definition
  • E2E negative tests: cursor on , , in 注文が届く → no hover result
  • Local VsCode extension tests pass (Single-Root: 13 passing, macOS darwin-arm64)
  • Fork CI run: https://github.com/aromarious/contextive/actions/runs/22651696807

🤖 Generated with Claude Code

Previously, hovering anywhere in a CJK token (e.g. 注文が届く) would
show definitions for all matching substrings regardless of cursor
position. Now the hover handler computes the cursor offset within the
token and only returns definitions for terms whose matched substring
spans the cursor position.

- Add Lexer.getWithStart to return token string with start column
- Add TextDocument.findTokenWithStart for hover (findToken kept for completion)
- Filter findMatchingTermsBySubstring by cursor offset in token
- Add positive and negative E2E hover tests for CJK position accuracy
- Add CJKDemo workspace fixture for manual testing

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@aromarious aromarious force-pushed the feat/cjk-substring-matching branch from af37ad0 to 79daacd Compare March 4, 2026 02:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant