SDF Analyzer VSCode Extension
The SDF Analyzer is a Visual Studio Code extension designed for developers working with SQL warehouses defined within the context of an SDF workspace.
Community and Support
We value your input and encourage you to be part of our growing community! Join us at sdf.com/join to:
- Provide feedback on the SDF Analyzer extension
- Suggest new features
- Report bugs
- Discuss anything related to SDF
- Connect with other SDF users and developers
Your participation helps us improve the SDF ecosystem and tailor our tools to better meet your needs. We look forward to hearing from you!
Features
The SDF Analyzer extension allows you to execute SDF command-line tools directly from VS Code, enhancing your development workflow:
- Compile: Compile SQL files or the entire workspace.
- Compile File:
Ctrl+Shift+B
(Windows/Linux) / Cmd+Shift+B
(Mac)
- Compile Workspace:
Ctrl+K Ctrl+B
(Windows/Linux) / Cmd+K Cmd+B
(Mac)
- Run: Execute SQL files or run the entire workspace.
- Run File:
Ctrl+Shift+R
(Windows/Linux) / Cmd+Shift+R
(Mac)
- Run Workspace:
Ctrl+K Ctrl+R
(Windows/Linux) / Cmd+K Cmd+R
(Mac)
- Test: Run tests for SQL files or the entire workspace.
- Test File:
Ctrl+Shift+T
(Windows/Linux) / Cmd+Shift+T
(Mac)
- Test Workspace:
Ctrl+K Ctrl+T
(Windows/Linux) / Cmd+K Cmd+T
(Mac)
- Clean Cache: Clean the SDF cache.
- Command Palette:
Ctrl+Shift+P
/ Cmd+Shift+P
, then type SDF: Clean Cache
These commands are accessible through the Command Palette or via the default keybindings, streamlining your development process by eliminating the need to switch contexts.
Upcoming Features
We are actively working on adding more capabilities to the SDF Analyzer extension:
- Enhanced Viewing Capabilities: Integration of features like "Go to Definition" and on-hover context tips to improve code navigation and comprehension.
- IntelliSense and Code Completion: Advanced code editing features including IntelliSense for smarter code completion, syntax suggestions, and real-time error checking to assist with writing SQL code more efficiently.
Stay tuned for updates as we continue to enhance the SDF Analyzer extension to support these additional features!
Installation
To install the SDF Analyzer extension:
- Open Visual Studio Code.
- Navigate to the Extensions view by clicking on the square icon on the sidebar or by pressing
Ctrl+Shift+X
(Windows/Linux) / Cmd+Shift+X
(Mac).
- Search for "SDF Analyzer".
- Click on Install.
Prerequisites
Note: Upon installation and activation of the SDF Analyzer extension, the extension will prompt you to configure these settings if they are not already configured.
If you'd like to setup the pre-requisites manually before using the SDF Analyzer extension, ensure you have the SDF binary installed on your system. You can download and install it from:
docs.sdf.com/introduction/install
Follow the installation instructions provided on the SDF documentation site for your specific operating system.
Configuration
After installation, you may want to configure the extension to better fit your development environment.
Extension Settings
The SDF Analyzer extension contributes the following settings:
Path to SDF Binary
If you have the binary installed in a non-standard location, you can change the path to the binary in the settings via Preferences: Open Settings (JSON)
.
{
"sdfAnalyzer.pathToSDF": "/path/to/sdf"
}
Binary Execution Permissions
Ensure that the SDF binary has the correct permissions to be executed by VS Code. You may need to modify the file permissions:
On Unix-based systems (Linux, macOS):
chmod +x /path/to/sdf
On Windows:
Ensure the file has the "Read & execute" permission for your user account.
If you're still encountering issues, you may need to run VS Code with elevated privileges or adjust your system's security settings.
Usage
Once installed and configured, the SDF Analyzer automatically activates when you open vscode to the root of an SDF workspace containing a workspace.sdf.yml
file.
To use the SDF Analyzer, you can use the following commands found in the Command Palette (Ctrl+Shift+P
/ Cmd+Shift+P
) by typing SDF:
- Compile File: Compiles the current SQL file.
- Run File: Executes the current SQL file.
- Test File: Runs tests for the current SQL file.
- Lint File: Lints the current SQL file.
- Format File: Formats the current SQL file.
- Compile Workspace: Compiles the entire workspace.
- Run Workspace: Executes the entire workspace.
- Test Workspace: Runs tests for the entire workspace.
- Clean Cache: Cleans the SDF cache.
Note: All file-related commands (e.g., Compile File, Run File) automatically save the current file before execution. Similarly, all workspace-related commands (e.g., Compile Workspace, Run Workspace) automatically save all open files in the workspace before execution.
You can access these commands through the Command Palette (Ctrl+Shift+P
/ Cmd+Shift+P
) by typing SDF and selecting the desired command.
Support
For assistance with the SDF Analyzer, you can:
- Community Forum: Join our community at sdf.com/join to ask questions and share feedback.
- GitHub Issues: Report issues or suggest features on our GitHub Issues page.
We welcome feedback and contributions to improve the extension.
Thank you for choosing SDF Analyzer to enhance your SQL warehouse development workflow!
Default Keybindings
SDF Analyzer comes with the following default keybindings:
Command |
Windows/Linux |
Mac |
Compile File |
Ctrl+D |
Cmd+D |
Run File |
Ctrl+R |
Cmd+R |
Test File |
Ctrl+T |
Cmd+T |
Compile Workspace |
Ctrl+D Ctrl+D |
Cmd+D Cmd+D |
Run Workspace |
Ctrl+R Ctrl+R |
Cmd+R Cmd+R |
Test Workspace |
Ctrl+T Ctrl+T |
Cmd+T Cmd+T |
Clean Cache |
Ctrl+Y Ctrl+Y |
Cmd+Y Cmd+Y |
Format File |
Option+F Option+F |
Option+F Option+F |
Lint File |
Option+L |
Option+L |
Lint Fix File |
Option+L Option+L |
Option+L Option+L |
These keybindings are active when editing SQL files. You can customize these keybindings in your VS Code settings if you prefer different shortcuts.
Changing Keybindings
To change a keybinding:
- Open the Keyboard Shortcuts editor in VS Code (
cmd + shift + p
and type Keyboard Shortcuts
).
- Search for the command you want to change (e.g., "SDF: Compile File").
- Click on the pencil icon next to the command and enter your preferred keybinding.
Remember, your custom keybindings will override the default ones provided by the extension.