Use the Flux VS Code extension
The Flux Visual Studio Code (VS Code) extension provides Flux syntax highlighting, autocompletion, and a direct InfluxDB server integration that lets you run Flux scripts natively and show results in VS Code.
On this page
- Install the Flux VS Code extension
- Connect to InfluxDB
- Query InfluxDB from VS Code
- Explore your schema
- Debug Flux queries
- Upgrade the Flux extension
- Flux extension commands
Install the Flux VS Code extension
The Flux VS Code extension is available in the Visual Studio Marketplace. For information about installing extensions from the Visual Studio marketplace, see the Extension Marketplace documentation.
Connect to InfluxDB
To create an InfluxDB connection in VS Code:
Hover over the InfluxDB pane and then click the icon that appears.
Provide the required connection credentials:
Click Test to test the connection.
Once tested successfully, click Save.
Manage InfluxDB connections
In the InfluxDB pane:
- To edit a connection, right click on the connection to edit and select Edit Connection.
- To remove a connection, right click on the connection to remove and select Remove Connection.
- To switch to a connection, right click on the connection to switch to and select Switch To This Connection.
Query InfluxDB from VS Code
- Write your Flux query in a new VS Code file.
- Save your Flux script with the
.fluxextension or set the VS Code Language Mode to Flux.
- Execute the query with the
- Query results appear in a new tab. If query results do not appear, see Debug Flux queries.
Explore your schema
After you’ve configured an InfluxDB connection, VS Code provides an overview of buckets, measurements, and tags in your InfluxDB organization. Use the InfluxDB pane in VS code to explore your schema.
Debug Flux queries
To view errors returned from Flux script executions, click the Errors and Warnings icons in the bottom left of your VS Code window, and then select the Output tab in the debugging pane.
Upgrade the Flux extension
VS Code auto-updates extensions by default, but you are able to disable auto-update.
If you disable auto-update, manually update your VS Code Flux extension.
After updating the extension, reload your VS Code window (
Reload Window) to initialize the updated extensions.
Flux extension commands
|Command||Description||Keyboard shortcut||Menu context|
Support and feedback
Thank you for being part of our community! We welcome and encourage your feedback and bug reports for InfluxDB and this documentation. To find support, the following resources are available:
InfluxDB Cloud and InfluxDB Enterprise customers can contact InfluxData Support.