Take includeDeclaration into account#2427
Conversation
|
According to mypy_primer, this change doesn't affect type check results on a corpus of open source code. ✅ |
kinto0
left a comment
There was a problem hiding this comment.
looks great! now we just need to let people set this
| handle, | ||
| uri, | ||
| params.text_document_position.position, | ||
| true, |
There was a problem hiding this comment.
we probably need to allow this to be configured via the lsp config workspace_configuration_response
There was a problem hiding this comment.
Sorry for the late response. I haven't touched the configuration code before.
I think you mean to add it to so it can be set:
pyrefly/pyrefly/lib/lsp/non_wasm/workspace.rs
Lines 283 to 291 in aeb2b10
But I'm not quite sure in which section it should be?
Or should it be in Workspace?
Happy to make the change, just don't really know where I should make it 😅
There was a problem hiding this comment.
if we put it in the PyreflyClientConfig, it'll be accessible by LSP via configuration and initializationOptions. see the tip in our wiki here (we probably should make this info easier to understand and find)
There was a problem hiding this comment.
@kinto0 Added it, but I'm not 100% confident in the change 😅
Not sure where the config belongs to, and I think with the current change it will default to false whereas main uses true considering it doesn't even look at the argument.
Any pointers are welcome! :)
There was a problem hiding this comment.
I'm sorry, I misunderstood this part! includeDeclaration is only part of references params, so the question is what to do with rename. I think the old behavior is the only correct behavior, since renaming must include declarations otherwise the references would reference the wrong thing
|
now that i'm looking at it more directly to resolve conflicts, I'm noticing a few other things:
i'm just fixing these up since they're quick and i've already resolved the conflicts |
stroxler
left a comment
There was a problem hiding this comment.
Review automatically exported from Phabricator review in Meta.
|
Thanks @kinto0 Still getting used to the codebase. Happy to see they trigger further improvements :) |
Summary
Closes #2126
Not sure if just passing the
boolaround is the best, but I guess it works? 😄The logic for
referencesmight also not be fully idiomatic. So very open to feedback and suggestions.Test Plan
I copied
test_references_cross_file_no_configfrom the test file as it seems to use a module that is pretty simple. From the expected test output I removed the declaration, and that test now passes.