Skip to content

fix support the + - in hover panel #2974#4116

Open
asukaminato0721 wants to merge 1 commit into
facebook:mainfrom
asukaminato0721:2974
Open

fix support the + - in hover panel #2974#4116
asukaminato0721 wants to merge 1 commit into
facebook:mainfrom
asukaminato0721:2974

Conversation

@asukaminato0721

@asukaminato0721 asukaminato0721 commented Jul 11, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes #2974

Added VS Code +/- hover verbosity controls.

Compact hovers preserve named union aliases; expanded hovers reveal their members.

Added the custom client/server hover protocol while preserving standard LSP behavior.

Raised the extension requirement to VS Code 1.103 for hover verbosity support.


why there is an extra .d.ts:

Because hover verbosity is still a proposed VS Code API. The stable @types/vscode package does not declare VerboseHover, HoverContext and the fourth provideHover argument.

In TypeScript, there are multiple expand levels.

Here we simplified it to only compact and expand.

Test Plan

add test

@github-actions

This comment has been minimized.

@kinto0 kinto0 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cool idea. I like it a lot. I think we're OK with the increase in VSCode version (as long as that's the minimum we can do it on) but I left a few comments

Comment thread lsp/package.json
Comment thread pyrefly/lib/lsp/non_wasm/server.rs Outdated
Comment thread pyrefly/lib/lsp/non_wasm/server.rs Outdated
Comment thread pyrefly/lib/lsp/wasm/hover.rs Outdated
Comment thread pyrefly/lib/lsp/wasm/hover.rs Outdated
Comment thread pyrefly/lib/lsp/wasm/hover.rs Outdated
Comment thread pyrefly/lib/lsp/wasm/hover.rs Outdated
@github-actions

This comment has been minimized.

@asukaminato0721 asukaminato0721 requested a review from kinto0 July 14, 2026 03:07
Comment thread pyrefly/lib/lsp/wasm/hover.rs Outdated
let mut cloned = type_.clone();
move |solver| {
// Hover verbosity currently has two states: named nested unions or fully expanded.
let expand_unions = verbosity_level > 0;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
let expand_unions = verbosity_level > 0;
let unions_expanded = verbosity_level > 0;

unclear that this is a state. it sounds like a verb, "should we expand unions"

Comment thread pyrefly/lib/lsp/wasm/hover.rs Outdated
transaction.ad_hoc_solve(handle, "hover_display", {
let mut cloned = type_.clone();
move |solver| {
// Hover verbosity currently has two states: named nested unions or fully expanded.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this comment belongs in the HoverResult struct so it's more visible. with the suggested rename, I think it is clear

@kinto0 kinto0 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks! just a few more nits

@github-actions

Copy link
Copy Markdown

According to mypy_primer, this change doesn't affect type check results on a corpus of open source code. ✅

@meta-codesync

meta-codesync Bot commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

@kinto0 has imported this pull request. If you are a Meta employee, you can view this in D111971431.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

support the + - in hover panel

2 participants