Mohit Garg
Mohit Garg

Reputation: 355

How to prevent the repetition of object name for Python using autocompletion in VSCode?

I am using VSCode for writing Python code in a Jupyter Notebook. The relevant extensions installed are Python, Pylance and Jupyter. The problem occurs when I try to use tab to autocomplete method names for any object. For example, if the suggestion box looks like this:

enter image description here

and I press Tab to accept the suggestion, the object name database is repeated i.e the code looks like dataset.dataset.as_numpy_iterator instead of dataset.as_numpy_iterator. How can I remove this object name duplication? Thanks!

Upvotes: 1

Views: 538

Answers (3)

L. Wang
L. Wang

Reputation: 1

I bumped into the same issue. Simply disabling and re-enabling the Jupyter Keymap extension solved my problem.

Judging from the lack of related search results, this issue seems to occur only under some rare circumstance...

Upvotes: 0

Mohit Garg
Mohit Garg

Reputation: 355

After wasting a lot of time searching for a fix, I tried using the latest Insider's build (instead of the stable build) of VSCode and surprise surprise - it did not have this issue. Moreover, even in the stable build, it occurs only in Jupyter Notebooks and not in standalone .py files. I am posting this as an answer so that other people don't have to waste more time on this!

Upvotes: 2

Steven-MSFT
Steven-MSFT

Reputation: 8411

It looks like provided by some extension you have installed. Such as Tabnine AI, Kite and so on. But I can't reproduce it on both of them.

I can't get to know which extension provides it in your picture, it looks like was cut off in your picture. But it does not provide by the Python extension.

enter image description here

Upvotes: 0

Related Questions