This tutorial aims to guide you through the process of analyzing configuration files from LabVIEW and TestStand using Visual Studio Code. You'll learn how to set up and utilize VS Code for this purpose, focusing on specific file types.
- Install Visual Studio Code.
- Install the XML Tools Extension.
- Install the Ini for VSCode Extension.
TestStand stores configuration filesin the \Cfg and \Cfg\ModelPlugins directories. Click on this link for a list of commonly modified configuration files, with the information TestStand stores in those files, and whether to include those configuration files in a deployment.
Now, let's open one of these folders and use VS code to analyze the files.
- Navigate to the
<TestStandAppData>\Cfg
folder. - Open the extracted folder. Right-click and select "Open with VS Code".
- The name of this option might slightly vary depending on your VS Code version.
Note: You might encounter a "Do you trust the authors of the files in this folder?" prompt. If prompted, ensure you trust the authors of all files in the parent folder and click "Yes, I trust the authors."
-
The TestStand
Cfg
folder becomes your active workspace. Now, you need to establish the workspace settings. -
Press
Ctrl+Shift+P
to open the command palette. Type "Preferences: Open Workspace Settings (JSON)".- This action creates a
.vscode
directory in your workspace root, containing asettings.json
file to store workspace-specific settings.
- This action creates a
Note: This step is necessary because some TestStand config files have custom extensions but adhere to standard formatting. For instance,
SearchDirectories.cfg
andFileDiffer.ini
contain XML strings as their content.
- Paste the following JSON string into the
settings.json
file:
{
"files.associations": {
// Parse as XML
"*.cfg": "xml",
"SequenceEditor.isl": "xml",
"FileDiffer.ini": "xml",
"Analyzer.ini": "xml",
"CustomRules.tsarules": "xml",
// Parse as INI
"TeststandPersistedOptions.opt": "ini"
}
}
- Notice that the config files are now parsed correctly, enabling easy navigation. XML files display the XML Document section in the Explorer pane, while INI files show the Outline section. In both cases, you can navigate the file by clicking the navigation bar at the top of the file display pane.
Note: VS Code won't display binary files. If you encounter one, VS Code will notify you that it's unable to display a binary file.
In contrast to TestStand, creating a workspace for the INI file isn't necessary. Here, you'll learn how to set the file association for a single file.
-
Right-click and open the
LabVIEW.ini
file located at<Program Files>\National Instruments\LabVIEW 20XX
. Choose the option "Edit with VS Code". -
The file should be parsed by the Ini for VSCode Extension. If it isn't, you can click the current associated file type on the status bar at the bottom of the UI, then type "ini" and press enter. The file should now be parsed as an INI file.
-
Utilize the Outline section or the navigation bar to explore the file's sections and keys.
If there are common issues or challenges that readers might encounter, list them here along with possible solutions or workarounds.
-
Issue 1: Description of the issue.
- Solution or workaround.
-
Issue 2: Description of the issue.
- Solution or workaround.
In this tutorial, you've learned how to effectively analyze configuration files from LabVIEW and TestStand using Visual Studio Code. By setting up the appropriate extensions and workspace settings, you can easily navigate and understand the content of these configuration files. Visual Studio Code provides a versatile and user-friendly environment for exploring these files, helping you gain insights into your LabVIEW and TestStand setups. Armed with this knowledge, you'll be better equipped to manage and fine-tune your system configurations efficiently.
- Configuration Files
- LabVIEW configuration file - Not NI Official
- File Associations - VS Code Docs
Feedback: Help us improve this tutorial. Please provide feedback, report issues, or suggest enhancements. 😃
Author: Felipe Flores, Senior Technical Support Engineer at NI.
Last Updated: August 15th, 2023.