Skip to content

Find all references in VS Code extension does not find call sites #2362

@AdemFr

Description

@AdemFr

Summary

Thanks for building Ty! Super excited about the project.
I set up ty using the cursor / vs code extension for the language server.

One of the critical use cases for type hints etc for me is finding / renaming all references of variables and attributes reliably.

This does not seem to work when searching for references based on the method argument across different files, but works when searching based on the call site or within the same file.

Playground Link

example_rename.py

from .example_rename_2 import ExampleClass

if __name__ == "__main__":
    instance = ExampleClass(old_name="test")  # Find all references for old_name works here
    result = instance.method("world")

example_rename_2.py

class ExampleClass:
    def __init__(self, old_name: str) -> None:    # Find all references for old_name only finds usages within file
        self.old_name = old_name

    def method(self, old_name: str) -> str:
        return f"Hello {old_name}"
Image Image Image

Expected

I would expect the same result, no matter where I search for references from. This also breaks renaming, when triggered from the class attribute, and will not rename call sites.

Version

0.0.9

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingserverRelated to the LSP server

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions