Skip to content

self. completions (from #5773) should not override local parameter completions / add setting to disable #7895

@Slushie7

Description

@Slushie7

Environment data

  • Pylance version: v2026.1.1
  • OS and version: Windows 11
  • Python version (& distribution if applicable, e.g. Anaconda): Python 3.13.7

Code Snippet

class SomeClass:
    def update_trees(self)->None:
        ...
    
    def some_method(self, update_trees:bool)->None:
        if update_trees: # <-- issue occurs while typing this
            self.update_trees()

Repro Steps

  1. Create a class with an instance method named "update_trees"
  2. Create another instance method that accepts a parameter named "update_trees"
  3. Start typing something that triggers the autocomplete suggestion for "update_trees"
  4. Select the first autocomplete suggestion
  5. The symbol is changed to "self.update_trees"

Expected behavior

When typing "upd" inside some_method, the local parameter update_trees should be the top completion suggestion (accepting the top suggestion should insert "update_trees" instead of "self.update_trees").

Actual behavior

After the 2026.1.1 update (which added self. completions via #5773), "self.update_trees" is the top suggestion. Pressing Enter inserts "self.update_trees" instead of the local parameter "update_trees". This is incorrect in context — the method's parameter should take priority over the instance method when names collide.

Request

  1. When a local variable/parameter shares a name with an instance method or attribute, the local symbol should be prioritized in completions.
  2. Alternatively, please add a setting that controls this autocompletion behavior (or disables self. completions entirely).

Metadata

Metadata

Assignees

Labels

ai-triage-respondedIndicate whether the AI triage agent has responded to this issue.fixed in next version (main)A fix has been implemented and will appear in an upcoming versionrepro workspaceIssue has a retained repro workspaceteam needs to reproduceIssue has not been reproduced yet

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions