Skip to content

Code completion sometimes shows stale results #3160

@DanTup

Description

@DanTup

Here, notice name5 that is defined in the file on the right is missing from the completion list:

Screenshot 2021-02-24 at 11 04 24

I can reproduce this by:

  • Clearing the ~/.dartServer folder
  • Open this project, including the (right) file myfoo.dart
  • Add a new field to the class definition (name6)
  • Save all files
  • Restart VS Code
  • Wait for analysis to complete
  • Invoke completion

My theory is that this is related to using simple increasing integers as modified stamps (see here). When you open the file for the first time, the modification stamp is 0 or 1 (depending on the order of opened files), and this is embedded in cached data. When you reopen the project, even after the file was modified, the new instance of the server again starts from 0 and decides the cached data is still valid.

@bwilkerson @scheglov does this sound plausible? I can repro both on LSP and the original protocol.

Metadata

Metadata

Assignees

No one assigned

    Labels

    in editorRelates to code editing or language featuresin lsp/analysis serverSomething to be fixed in the Dart analysis serveris bug

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions