2

As a followup to this question, in my VS Code I have a bunch of autocomplete snippets I haven't been able to ascertain the source of. All the snippets in the image below give me indentation problems when autocompleting.

enter image description here

autocompletes to

enter image description here

Notice the single space in the second line instead of a tab (or 4 spaces).

However, none of these (clearly python) snippets seem to come from the official Python VSC extension (see above question), or in fact any other extension in ~/.vscode/extensions/. They are also not my own snippets.

Is there some way in VS Code (perhaps by turning on some debugging functionality or checking certain logs) to find out where these snippets are defined so I can fix/override them?

Mate de Vita
  • 1,102
  • 12
  • 32

1 Answers1

1

They are generated by the extension ms-python.python-2020.2.64397.

If I disable the extension and restart VSC they are gone.

For me the indentation after expansion is correct. With the difference that def __init__ results in

  def __init__(self):
    super().__init__()

Try clearing your settings, User, Workspace, Folder, and see if that makes a difference.

Searching the extension I found a possible location

~/.vscode/extensions/ms-python.python-2020.2.64397/languageServer.0.5.31/scrape_module.py

In the class Signature (near line 162) there are a couple of class variables, KNOWN_RESTYPES and KNOWN_ARGSPECS that contain some kind of templates. Later on they are modified add_builtin_objects based on the number of arguments to the script.

rioV8
  • 24,506
  • 3
  • 32
  • 49
  • I just tried it at home on a Windows machine. Completely removed VS Code (also deleted `%APPDATA%\Code` and `C:\Users\Me\.vscode`) and reinstalled it. Installed only the Python extension. The only thing I changed in settings was changing the theme to light mode (yes, I use light mode). Still getting the same dropdown suggestions and still getting the same result with a single space indent. – Mate de Vita Mar 13 '20 at 21:11
  • @MatedeVita I'm also using Windows, VSC 1.42 and Light Theme (much better for the eyes, dark theme only useful for 3D modelling). Don't forget the settings file in the folder `.vscode` of the workspace – rioV8 Mar 14 '20 at 01:11
  • I don't have a `.vscode` folder in my current workspace. Also this problem happens in all of my projects as far as I can tell, so I don't think it's related to a specific `settings.json` or any other workspace-specific file. P.S. Finally someone agrees with me regarding light vs dark mode :) – Mate de Vita Mar 14 '20 at 13:01