Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

First time completion list is almost always wrong b/c of analysis delay #4032

Closed
MikhailArkhipov opened this issue Apr 10, 2018 · 1 comment

Comments

@MikhailArkhipov
Copy link

MikhailArkhipov commented Apr 10, 2018

Reproes also in VS - VS simply shows no completions.

In VSC:

class Employee:
    'Common base class for all employees'
    empCount = 0

    def __init__(self, name, salary):
        self.name = name
        self.salary = salary
        Employee.empCount += 1

p1 = Employee('Bob', 1)

Type p1. or delete and retype .

image

Now, close completion and ctrl+space

image

Ideally engine should be able to provide completions from the previous snapshot without having to wait for the analysis to complete.

@MikhailArkhipov MikhailArkhipov changed the title First time completion list is almost always wrong b/c of analyzis delay First time completion list is almost always wrong b/c of analysis delay Apr 10, 2018
@zooba
Copy link
Member

zooba commented Apr 13, 2018

It generally can do this already, but there are some cases where a race occurs.

The analyzer uses incremental reanalysis, and has thread-safe querying during this process. When we requeue a class definition it clears out all values of that class type in preparation for the new type becoming available, which is likely where you are getting the incomplete analysis from.

We don't snapshot the entire set of completion results. The memory requirements for this would be prohibitive. At best we could cache prior requests, but that doesn't seem like a genuine solution (at first glance, at least, I could be wrong).

The delay on the first run is somewhat unavoidable, unless we lock out users from doing anything until we've finished initializing. There is no "previous snapshot" in this case. VS still has synchronous completions, which is why it times out and you see nothing (though I'm working on fixing this already), and if you wait for completions without analysis then you aren't going to see anything useful.

We should be able to support the "incomplete" flag here, at least in VSC, which will cause it to requery and hopefully get complete results after a few seconds. I'll see how easily I can add that in to my current changes - I think it'll just want to match the "IsAnalyzed" flag of the entry being queried.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants