Repository navigation
Conversation
|
All commit authors have signed the Contributor License Agreement. Thank you! |
Author
|
recheck |
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.
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) orCtrl(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.Language::has_definitions()inwinc-syntaxas 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.doc.lsp_attached()gate inApp::definition_name_atwhenlanguage.has_definitions()is true. Makedefinition_name_attake&mut selfand resolve the line's highlight state viadoc.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.App::modifiers_changedinevents.rs, runtab_switch_modifiers()beforeupdate_text_link(), and callupdate_cursor_icon()unconditionally so the pointer switches between text and hand without moving the mouse.Change type
Verification
cargo fmt --all --checkcargo clippy -p winc-syntax -p winc-app --all-targets -- -D warnings, plusRUSTDOCFLAGS="-D warnings" cargo doc -p winc-syntax -p winc-app --no-depscargo xtask test --all(rancargo test -p winc-syntaxwith 114 passed,cargo test -p winc-app -- linkswith 32 passed, fullwinc-applibrary tests with 1500 passed, andcargo build --bin winc)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 benchagainstdev(5fac00ca), run back to back on the same macOS machine:devlarge.rs, 20 runs)huge.txt/huge.rs, 5 runs)large.rs/huge.txt/huge.rs)large.rs)large.rs)large.rs/minified.js/huge.txt/huge.rs)The
large.rsstartup median and Vim key p95 (17.5 ms ondevvs 17.6 ms on branch) are over budget ondevon this machine and are unchanged here.Screenshots
The same Python file without a language server attached, with the pointer stationary over
calculate_totalbefore and while holdingCmd.Cmdreleased)Cmd)Checklist
cargo xtask benchwhen in doubt).