A Visual Studio Code extension that provides development support for NI DataPlugins written in Python. For more information about writing Python DataPlugins, please refer to the SystemLink Operations Handbook.
Step 1. Install this extension. Download from marketplace or download the latest vsix from Release.
- Open Visual Studio Code and select View->Extensions from the menu to display the Extensions pane.
- Click the ... in the top-right corner of the Extensions pane and select Install from VSIX.
- Locate the .vsix file you download and click Open.
- Click Restart to confirm.
Step 2. Create a new DataPlugin. Launch VSCode Command Palette (Ctrl+Shift+P), paste the command below, and press Enter.
NI DataPlugins: Create new Python-DataPlugin
Step 3. Export the DataPlugin. Right-click the *.py file you want to export.
- NI DataPlugins: Export DataPlugin: Your code will be embedded in a *.uri file that you can share with others.
- NI DataPlugins: Register DataPlugin for Development (CTRL+ALT+F5): Use this option to register the DataPlugin exclusively on your development machine and test your code changes in DIAdem, LabVIEW, or SystemLink.
This extension defines a few helpful Snippets that extend the auto-completion capabilities of VSCode. Start typing and press Ctrl+Space to display a list of suggestions.
Use the following Snippets to quickly select a supported data type:
DataTypeChnFloat32
DataTypeChnFloat64
DataTypeChnString
DataTypeChnDate
DataTypeChnUInt8
DataTypeChnInt16
DataTypeChnInt32
DataTypeChnInt64
Use the following Snippets to insert the most common stubs:
if __name__ == "__main__"
def read_channel_length
def read_channel_values
def read_store
Feel free to contribute additional Snippets to the project: snippets/snippets.json
Start writing your DataPlugin with your own custom template. Simply add your template to the examples
directory. You find the examples folder at $HOME/.vscode/extensions/ni.vscode-ni-python-dataplugins-<version>
under Mac and Linux or at %USERPROFILE%\.vscode\extensions\ni.vscode-ni-python-dataplugins-<version>
folder under Windows.
Create a file .file-extensions
in the root directory of your project and list all file extensions that you want your DataPlugin to support. If no list is defined, you will be prompted to provide a list of file extensions when you export your DataPlugin.
Set the export path for all your plugins in Preferences -> Settings -> Extensions -> Python DataPlugins -> Export Path. The path can be a folder or a *.uri file.
Example
{
"Python-DataPlugins.exportPath": "C:\\Temp"
}
// OR
{
"Python-DataPlugins.exportPath": "C:\\Temp\\MyPlugin.uri"
}
Contribute to this project by finding issues, requesting features or creating Pull Requests. General documentation about developing extensions for Visual Studio Code can be found here and here.
To compile this extension, run:
git clone https://github.com/ni/vscode-ni-python-dataplugins.git
cd vscode-ni-python-dataplugins
npm install
To test your changes, run:
npm run lint
npm run test
npm run test:e2e
Run the extension from VSCode by pressing F5
.
See LICENSE for details about how this extension is licensed.