When I type out something like np.
I think this triggers Visual Studio Code + Pylance's (not sure) auto-import completion by suggesting that import numpy as np
might be relevant.
I would like to create similar custom auto-import/complete associations. For example: between pl
and polars
, so that if I type something like pl.
then import polars as pl
is given as an auto-import suggestion.
How can I do this? Is this specific to the Pylance extension I am using, or something about Visual Studio Code?
Please note that auto-import/import-completion is very different from custom code snippets, as covered in How to add custom code snippets in VSCode? The reason for this being:
This is tracked by an open enhancement request: Allow auto-import abbreviations to be configured #2589. I suggest that you give that discussion an upvote to show support for it. You can also subscribe to it to get notified about discussion and progress. Please avoid making noisy comments there like ones that just consist of "+1" / "bump".