ignition-sift
Barebones, stub-driven auto-imports for Ignition scripting projects.
Motivation
After using Ignition Flint for the past year, I no longer use the lack-luster script editor baked into the ignition designer.
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+.
- No LSP required
Requirements
Getting Started
Install the extension
Ignition Sift can be installed on the code registry or openvsx.
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
On a new project, you will want to run both initStubs and generateAllStubs.
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.

Ignition Flint
As mentioned in the motivation, I have been using Ignition Flint for a while and it has worked beautifully and allowed us to offload the development to an external editor. You will be recommended to download Ignition Flint but it is by no means required. Just a great extension!
Ignition Flint Example Config (Workspace)
To ensure the same DX for all developers, you should create a .code-workspace file where you can store configurations across environments. Ignition Sift's configurations and many others can be stored this way.
"ignitionFlint.ignitionGateways": [
{
"label": "localhost",
"address": "http://localhost:80",
"projectPaths": [
"/var/ignition-poc/ignition/global"
],
"forceUpdateDesigner": true,
"updateDesignerOnSave": true,
"supportsProjectScanEndpoint": true,
}
],
To get the most out of Ignition Flint, installing the project scan endpoint will enable the gateway to show your changes in realtime.
Project Scan Endpoint