https://github.com/ni/vscode-ni-python-dataplugins
NI DataPlugins extension for Visual Studio Code
https://github.com/ni/vscode-ni-python-dataplugins
national-instruments ni-dataplugins python vscode-extension vsix
Last synced: 9 months ago
JSON representation
NI DataPlugins extension for Visual Studio Code
- Host: GitHub
- URL: https://github.com/ni/vscode-ni-python-dataplugins
- Owner: ni
- License: mit
- Created: 2020-04-04T10:57:35.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2023-07-19T02:44:09.000Z (almost 3 years ago)
- Last Synced: 2024-04-15T01:28:57.969Z (about 2 years ago)
- Topics: national-instruments, ni-dataplugins, python, vscode-extension, vsix
- Language: TypeScript
- Homepage:
- Size: 1.43 MB
- Stars: 4
- Watchers: 5
- Forks: 1
- Open Issues: 7
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Codeowners: .github/CODEOWNERS
Awesome Lists containing this project
README
# NI DataPlugins Extension for Visual Studio Code
A [Visual Studio Code](https://code.visualstudio.com/) extension that provides development support for [NI DataPlugins](https://www.ni.com/downloads/dataplugins) written in [Python](https://www.python.org). For more information about writing Python DataPlugins, please refer to the [SystemLink Operations Handbook](https://operations.systemlink.io/python-dataplugins/python-dataplugins).

## Quick Start
**Step 1.** Install this extension. Download from [marketplace](https://marketplace.visualstudio.com/items?itemName=ni.vscode-ni-python-dataplugins) or download the latest *vsix* from [Release](https://github.com/jschumme/vscode-ni-python-dataplugins/releases).
- 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__.
```json
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.
## Snippets
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](./snippets/snippets.json)
## Advanced Settings
### Custom Template
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-` under Mac and Linux or at `%USERPROFILE%\.vscode\extensions\ni.vscode-ni-python-dataplugins-` folder under Windows.
### .file-extensions
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.
### Export Path
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
```json
{
"Python-DataPlugins.exportPath": "C:\\Temp"
}
// OR
{
"Python-DataPlugins.exportPath": "C:\\Temp\\MyPlugin.uri"
}
```
## Contribute
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](https://code.visualstudio.com/api) and [here](https://vscode-docs.readthedocs.io/en/stable/extensions/debugging-extensions/).
### Developer Setup
To compile this extension, run:
```sh
git clone https://github.com/ni/vscode-ni-python-dataplugins.git
cd vscode-ni-python-dataplugins
npm install
```
To test your changes, run:
```sh
npm run lint
npm run test
npm run test:e2e
```
Run the extension from VSCode by pressing `F5`.
## License
See [LICENSE](https://github.com/ni/vscode-ni-python-dataplugins/blob/master/LICENSE) for details about how this extension is licensed.