Skip to content

Conversation

@Karman-singh15
Copy link
Contributor

Summary

Logic was added to post-process symbols inside a ClassDef.
it allows Stmt::FunctionDef to remain simple (always creating a FUNCTION), and shifts the responsibility of context-awareness (knowing it is a method) to the parent ClassDef.
Any child symbol with SymbolKind::FUNCTION is now converted to SymbolKind::METHOD

Fixes #2051

Test Plan

I updated the existing test
test_document_symbols_normal_file in pyrefly/lib/test/lsp/lsp_interaction/document_symbols.rs
The test uses an existing file normal.py which contains NormalClass and normal_method.
I updated the test assertion to verify that normal_method inside NormalClass has SymbolKind::METHOD.

@meta-cla meta-cla bot added the cla signed label Jan 14, 2026
@github-actions
Copy link

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

@stroxler
Copy link
Contributor

Thanks for the PR! Looks good to me, I'll try to get a second review and merge in the next day or two

Heads up that the red CI signal is just format, you can run cargo fmt to avoid it in the future but I can patch it up so no need to worry about it on this commit

@meta-codesync
Copy link

meta-codesync bot commented Jan 14, 2026

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

@stroxler stroxler self-assigned this Jan 14, 2026
Copy link
Contributor

@grievejia grievejia left a comment

Choose a reason for hiding this comment

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

Review automatically exported from Phabricator review in Meta.

@meta-codesync meta-codesync bot closed this in 159c5c3 Jan 14, 2026
@meta-codesync
Copy link

meta-codesync bot commented Jan 14, 2026

@stroxler merged this pull request in 159c5c3.

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.

'Go to symbol' excludes methods inside a class

4 participants