pyrefly icon indicating copy to clipboard operation
pyrefly copied to clipboard

fix numpy function hover missing name #1418

Open asukaminato0721 opened this issue 1 month ago • 3 comments

fix #1418

image

Added metadata-backed hover names by threading a display_name through every FindDefinitionItemWithDocstring so hover headers can still show identifiers even when we land in stub files or empty ranges.

Updated the hover formatter to try definition snippets, the metadata name, a type-derived fallback, and finally a lexical identifier; this restored headers for third-party symbols and ensured both WASM and native LSP paths behave identically

Introduced rich function rendering: callable tooltips now show (function) name plus a syntactically valid def name(...): ..., improving syntax highlighting in VS Code for cases like np.array.

asukaminato0721 avatar Nov 19 '25 16:11 asukaminato0721

improve #1416

image

asukaminato0721 avatar Nov 19 '25 16:11 asukaminato0721

fix #1348

image

asukaminato0721 avatar Nov 19 '25 16:11 asukaminato0721

Resolver didn’t keep a textual name when the definition expression was empty (e.g., stub attributes, keyword arguments, or type-only nodes). Fix: FindDefinitionItemWithDocstring now always carries a display_name, so when we do have definition metadata, we reuse that string.

Type-only lookup path – when we fail to find any definition (third-party binary stubs), we still need something readable. That’s why we fall back to metadata from Type::Function/Callable/BoundMethod/Forall.

Literal identifier under the cursor – in the degenerate case where neither of the above provides anything (e.g., a failing resolver on a local scratch buffer), we lex the identifier so we can at least echo the token.

asukaminato0721 avatar Nov 20 '25 01:11 asukaminato0721

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

meta-codesync[bot] avatar Dec 08 '25 17:12 meta-codesync[bot]

@kinto0 merged this pull request in facebook/pyrefly@9f8ec82817c1e1c22734695f0c0e08c61a609fa5.

meta-codesync[bot] avatar Dec 09 '25 23:12 meta-codesync[bot]