Keywords given in completion lists where they don't make sense #1234
Description
For the following lines, the completion list we return is the completion list for the global scope, which includes all of the keywords.
x + continu
x + pass
x else
or
None of these make sense in their contexts.
Peeking at TopLevelCompletions, there's a NoKeywords
flag, but it's never actually read anywhere, only set (and only set in some specific situations).
Unfortunately it seems like we rely on the editor to filter things and often just return the global scope along with the keywords. There are other places where this "global completion" can be improved, likely at the same time. For example
def f
Will give suggestions for what to name f
, even though the naming of that function cannot be related to any existing value (other than in the override scenario, which has its own specialized path). This can be opened as another issue if the fix is different.