How to fix VS Code autocompletion to access all layers of a Python.NET - .NET assembly interface?

144 Views Asked by At

I am programming in Python 3 in VS Code, using Python.NET to interface with a .NET based API (AudioPrecision.API.dll). I want to use autocomplete similar to Intellisense in Visual Studio, to make it easier to find and write APIs.

I have gotten most of the way there using the answers here: how-to-enable-intellisense-of-my-own-net-library-for-a-python-application-in-vi

IE:

  1. Install IronPython 2.7

  2. Download IronPython-Stubs

  3. Open cmd.exe, CD to the Stubs download directory.

  4. Run IronPython-Stubs with the following args:

    "C:\\Program Files\\IronPython 2.7\\ipy.exe" -m ironstubs make AudioPrecision.API --path="c:\\Program Files\\Audio Precision\\APx500 8.0\\API\\AudioPrecision.API.dll" --output stubs.min --overwrite
    
  5. Lastly,update ExtraPaths in VSCode Settings to include:

    C:\Users\...\\ironpython-stubs-master\ironpython-stubs-master\release\stubs.min
    

Unfortunately, while autocomplete now works at the first level, for example:

APx.AcousticResponse

Auto-complete working in VSCode

It does not work another level down, e.g.:

APx.AcousticResponse.RmsLevel

Auto-complete not working in VSCode

Any ideas how I can fix this?

1

There are 1 best solutions below

1
MingJie-MSFT On

One way is that you can try to set python.autoComplete.extraPaths in your settings.json to pre-loaded IntelliSense.

Another way is to try to let IntelliSense to do a deeper level of retrieval.

You can add the following codes to your settings to do it as long as you are okay to pay perf cost.

  "python.analysis.packageIndexDepths": [
    {
      "depth": 100,
      "includeAllSymbols": true,
      "name": ""
    },
  ],