Skip to content

feat: underline code identifiers on modifier hover without LSP - #1211

Open
shixy96 wants to merge 1 commit into
DEEIX-AI:devfrom
shixy96:feat/hover-underline-without-lsp
Open

shixy96 wants to merge 1 commit into
DEEIX-AI:devfrom
shixy96:feat/hover-underline-without-lsp

Conversation

@shixy96

@shixy96 shixy96 commented Dec 6, 2026 •

Copy link
Copy Markdown

Summary

Fixes #1208

This pull request covers the modifier-hover identifier link part of #1208. Follow-up pull requests handle definition context filtering and Find References separately.

Without a language server attached, holding Cmd (macOS) or Ctrl (Linux and Windows) over an identifier in a code file did not underline the name, and pressing or releasing the modifier while the pointer stayed still did not update the cursor icon.

  • Code language check: Add Language::has_definitions() in winc-syntax as a single source of truth. It excludes plain text, prose and diagram formats (markdown, latex, typst, mermaid), and literal data, config, log, diff, and table formats, while keeping programming languages, hcl, nix, html, wxml, and script-embedding templates.
  • No-LSP hover links and deep-file highlight state: Remove the doc.lsp_attached() gate in App::definition_name_at when language.has_definitions() is true. Make definition_name_at take &mut self and resolve the line's highlight state via doc.highlight_state(line, 256).unwrap_or_else(|| doc.approx_highlight_state(line)), so visible lines past line 256 in large or scrolled files still underline identifiers and skip comments, strings, escapes, keywords, and numbers.
  • Immediate cursor refresh: Extract App::modifiers_changed in events.rs, run tab_switch_modifiers() before update_text_link(), and call update_cursor_icon() unconditionally so the pointer switches between text and hand without moving the mouse.

Change type

  • Bug fix
  • Feature
  • Performance
  • Refactor
  • Documentation
  • Build / tooling

Verification

  • cargo fmt --all --check
  • cargo clippy -p winc-syntax -p winc-app --all-targets -- -D warnings, plus RUSTDOCFLAGS="-D warnings" cargo doc -p winc-syntax -p winc-app --no-deps
  • cargo xtask test --all (ran cargo test -p winc-syntax with 114 passed, cargo test -p winc-app -- links with 32 passed, full winc-app library tests with 1500 passed, and cargo build --bin winc)
  • Tested by hand on: macOS

Tests cover modifier press and release without pointer motion, skipping comments, strings, escapes, keywords, and numbers after scrolling past line 318, excluding non-code documents while preserving Markdown links, and keeping declarative and template code navigable.

cargo xtask bench against dev (5fac00ca), run back to back on the same macOS machine:

Metric dev Branch
Startup median (large.rs, 20 runs) 212.6 ms 233.6 ms
Startup median (huge.txt / huge.rs, 5 runs) 214.6 ms / 183.5 ms 193.1 ms / 186.8 ms
Scroll p95 (large.rs / huge.txt / huge.rs) 1.5 / 1.8 / 1.4 ms 1.2 / 1.8 / 1.4 ms
Typing to frame p95 (large.rs) 1.6 ms 1.8 ms
Highlight to end (large.rs) 74.6 ms 71.9 ms
Idle physical memory (large.rs / minified.js / huge.txt / huge.rs) 39 / 41 / 35 / 36 MB 39 / 41 / 35 / 36 MB

The large.rs startup median and Vim key p95 (17.5 ms on dev vs 17.6 ms on branch) are over budget on dev on this machine and are unchanged here.

Screenshots

The same Python file without a language server attached, with the pointer stationary over calculate_total before and while holding Cmd.

Before (Cmd released) After (holding Cmd)
Modifier released Holding Cmd over identifier

Checklist

  • The change is focused and does not include unrelated refactoring or formatting.
  • Tests cover the fixed bug or the new behavior.
  • New interface text is added in both English and Simplified Chinese.
  • Startup time, memory use, and large files are not made slower (run cargo xtask bench when in doubt).
  • I have read and agree to the Contributor License Agreement.

@github-actions

github-actions Bot commented Dec 6, 2026 •

Copy link
Copy Markdown

All commit authors have signed the Contributor License Agreement. Thank you!

@shixy96

shixy96 commented Dec 6, 2026

Copy link
Copy Markdown
Author

recheck

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.

[Feature]: Underline identifiers on modifier hover without LSP, mark definitions in references, and skip TypeScript type imports

1 participant