Skip to content

Publish diagnostics for all open files #1652

@MichaReiser

Description

@MichaReiser

ty's LSP does support the PublishDiagnostics notification, however, it only publishes the diagnostics for the changed file. It never pushes diagnostics for related files.

Let's say you have

lib.py:

class Foo:
    name: str

main.py:

from lib import Foo

foo = Foo()

print(foo.name)

Now, you change Foo.name to Foo.name2. Note, how ty doesn't show any diagnostics in main.py. The new diagnostics only show up once you start making changes to main.py

We should send the PublishNotification for all open documents. However, doing so on every didChange notification seems a bit much and possibly expensive. That's why I think the approach taken by Pyrefly to only do this in didSave seems reasonable.

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