Ignition Sift (VS Code Extension)
Barebones, stub-driven auto-imports for Ignition scripting projects.
Motivation
Ignition Sift aims to improve the developer experience by automatically adding imports in the Quick Fix menu. This extension remedies the need to always type out the absolute path where the developer can simply auto import the function. See Getting Started for more details.
Features
- Stub generation
- On save
- Bulk generation
- Ignition
system stubs
- Offers deterministic auto-imports via
ctrl+.
Requirements
Getting Started
Install the extension
Ignition Sift can be installed on the vscode marketplace, openvsx registry, or the releases page
Configuration Defaults
{
"ignitionSift.stubGenerator": "builtin", // Can pass in your own python file that generates the code for you.
"ignitionSift.stubDir": ".stubs", // Stubs directory location
"ignitionSift.pythonPath": "python3", // Binary for your python interpreter
"ignitionSift.generateStubsOnSave": true, // Keeps stubs up to date once you save a code.py
"ignitionSift.maxImportSuggestions": 15 // Keeps the quick fix decluttered by capping how many suggestions.
}
Requirement: Install Pyright
Ignition Sift relies on the flags that pyright raises in order to provide the Quick Fix menu. pyright is essentially a typing checker that provides very limited LSP functionality. Support for Python 2.7 (much less Jython) has been removed for jedi and is extremely limited for pylance hence why we are using pyright. For more information on pyright click here.
Ignition Sift should prompt you to download pyright.
Pyright Config pyrightconfig.json
Below is the recommended config for pyright.
Note: changing the stubs directory in Ignition Sift means you will need to change it in the pyright config
{
"include": ["."],
"extraPaths": ["./.stubs"],
"typeCheckingMode": "off",
"reportMissingImports": true,
"reportMissingModuleSource": false
}
Usage
Commands ctrl+shift+p
On a new project, you will want to run both initStubs and generateAllStubs.
Note: for stub generator, there is a builtin generator that I provide. but you can pass in your own. With this in mind, This extension can run code outside of vscode as we are calling a python binary.
ignitionSift.initStubs
- Adds the ignition native stubs to your
.stubs directory
ignitionSift.generateAllStubs
- Looks through entire project to find
code.py files and then generates stubs (YMMV for project inheritance)
Auto Import
Ignition Sift tries its best to stay out of the way. Pyright will be doing most of the work once a module has actually been imported. To get auto import suggestions, use ctrl+. on an undefined variable. Note: the lookup is case insensitive.
Example
Import System Function

Relative path added at top of file

Multiple Options


Once imported, pyright can take over in suggesting more functions and classes in the specific package.

User Created Function Reference
Once a file has been saved and a stub generated, we then can immediately auto import the code.

Showing script name
Since all python files are code.py, you can also create a custom label in your .code-workspace file in the settings key. This shows the package name rather than the code.py.
"workbench.editor.customLabels.enabled": true,
"workbench.editor.customLabels.patterns": {
"**/script-python/**/code.py": "${dirname}"
},
Disclaimer
Ignition Sift is an independent, unofficial VS Code extension and
is not affiliated with, endorsed by, or sponsored by
Inductive Automation.