-
Notifications
You must be signed in to change notification settings - Fork 30
Feature/query editor sql formater #238
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
erikdarlingdata
merged 11 commits into
erikdarlingdata:dev
from
rferraton:Feature/QueryEditor-SQLFormater
Apr 20, 2026
Merged
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
92a5cab
Query Editor SQL Formater with parameters options - init working
rferraton c2bc0d6
improve parameter format option grid ux
rferraton a2cb944
undo possible after format
rferraton 944e299
Dynamic brushes instead of hard coded color
rferraton 2452a42
remove unused using lib
rferraton 87991b1
Fix Reviewer remarks phase 1
rferraton 00e514c
Fix Second-opinion addendum
rferraton 4a05d0d
fix query editor content disapear if format have a syntax error. Now …
rferraton ae38892
1. Hardcoded colors in error dialog → Now uses (IBrush)this.FindResou…
rferraton 08f8173
dynamic brush for formatoptions
rferraton 3b275cf
Build passes. All three callers of Load(out string?)/Save(SqlFormatSe…
rferraton File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| # Third-Party Notices | ||
|
|
||
| This project incorporates material from the projects listed below. | ||
|
|
||
| --- | ||
|
|
||
| ## SqlFormatter | ||
|
|
||
| - **Source:** https://github.com/madskristensen/SqlFormatter | ||
| - **License:** MIT (Apache-2.0 per repository; individual files carry MIT terms) | ||
| - **Copyright:** Copyright (c) Mads Kristensen | ||
|
|
||
| The `SqlFormattingService` in this project was inspired by and partially derived | ||
| from the SqlFormatter extension for Visual Studio by Mads Kristensen. It uses | ||
| `Microsoft.SqlServer.TransactSql.ScriptDom` for T-SQL parsing and formatting. | ||
|
|
||
| ### MIT License | ||
|
|
||
| Permission is hereby granted, free of charge, to any person obtaining a copy | ||
| of this software and associated documentation files (the "Software"), to deal | ||
| in the Software without restriction, including without limitation the rights | ||
| to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
| copies of the Software, and to permit persons to whom the Software is | ||
| furnished to do so, subject to the following conditions: | ||
|
|
||
| The above copyright notice and this permission notice shall be included in all | ||
| copies or substantial portions of the Software. | ||
|
|
||
| THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
| IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
| FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
| AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
| LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
| OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
| SOFTWARE. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,121 @@ | ||
| <Window xmlns="https://github.com/avaloniaui" | ||
| xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | ||
| xmlns:dialogs="using:PlanViewer.App.Dialogs" | ||
| x:Class="PlanViewer.App.Dialogs.FormatOptionsWindow" | ||
| Title="SQL Format Options" | ||
| Width="650" Height="580" | ||
| MinWidth="520" MinHeight="400" | ||
| Background="{DynamicResource BackgroundBrush}" | ||
| Foreground="{DynamicResource ForegroundBrush}" | ||
| WindowStartupLocation="CenterOwner"> | ||
|
|
||
| <Window.Styles> | ||
| <Style Selector="ToggleSwitch"> | ||
| <Setter Property="OnContent" Value=""/> | ||
| <Setter Property="OffContent" Value=""/> | ||
| <Setter Property="MinWidth" Value="0"/> | ||
| <Setter Property="MinHeight" Value="0"/> | ||
| <Setter Property="Padding" Value="0"/> | ||
| <Setter Property="Margin" Value="0"/> | ||
| <Setter Property="VerticalAlignment" Value="Center"/> | ||
| <Setter Property="RenderTransformOrigin" Value="0%,50%"/> | ||
| <Setter Property="RenderTransform" Value="scale(0.75)"/> | ||
| </Style> | ||
| <Style Selector="ToggleSwitch:checked /template/ Border#SwitchKnobBounds"> | ||
| <Setter Property="Background" Value="{DynamicResource AccentBrush}"/> | ||
| <Setter Property="BorderBrush" Value="{DynamicResource AccentBrush}"/> | ||
| </Style> | ||
| <Style Selector="ToggleSwitch:checked /template/ Border#OuterBorder"> | ||
| <Setter Property="BorderBrush" Value="{DynamicResource AccentBrush}"/> | ||
| </Style> | ||
| </Window.Styles> | ||
|
|
||
| <Grid RowDefinitions="*,Auto" Margin="12"> | ||
| <DataGrid x:Name="OptionsGrid" Grid.Row="0" | ||
| x:DataType="dialogs:FormatOptionRow" | ||
| AutoGenerateColumns="False" | ||
| CanUserReorderColumns="False" | ||
| CanUserSortColumns="False" | ||
| HeadersVisibility="Column" | ||
| GridLinesVisibility="Horizontal" | ||
| IsReadOnly="False" | ||
| Background="{DynamicResource BackgroundBrush}" | ||
| Foreground="{DynamicResource ForegroundBrush}" | ||
| Margin="0,0,0,12"> | ||
| <DataGrid.Columns> | ||
| <DataGridTextColumn Header="Parameter" Binding="{Binding Name}" IsReadOnly="True" Width="2*"/> | ||
| <DataGridTemplateColumn Header="Current Value" Width="*"> | ||
| <DataGridTemplateColumn.CellTemplate> | ||
| <DataTemplate x:DataType="dialogs:FormatOptionRow"> | ||
| <Panel> | ||
| <ToggleSwitch IsChecked="{Binding BoolValue}" | ||
| IsVisible="{Binding IsBool}" | ||
| VerticalAlignment="Center" | ||
| Margin="4,0"/> | ||
| <ComboBox ItemsSource="{Binding ChoiceOptions}" | ||
| SelectedItem="{Binding CurrentValue}" | ||
| IsVisible="{Binding IsChoice}" | ||
| VerticalAlignment="Center" | ||
| MinHeight="0" Height="26" FontSize="12" | ||
| Margin="4,0"/> | ||
| <TextBlock Text="{Binding CurrentValue}" | ||
| IsVisible="{Binding IsText}" | ||
| VerticalAlignment="Center" | ||
| Margin="8,0"/> | ||
| </Panel> | ||
| </DataTemplate> | ||
| </DataGridTemplateColumn.CellTemplate> | ||
| <DataGridTemplateColumn.CellEditingTemplate> | ||
| <DataTemplate x:DataType="dialogs:FormatOptionRow"> | ||
| <Panel> | ||
| <ToggleSwitch IsChecked="{Binding BoolValue}" | ||
| IsVisible="{Binding IsBool}" | ||
| VerticalAlignment="Center" | ||
| Margin="4,0"/> | ||
| <ComboBox ItemsSource="{Binding ChoiceOptions}" | ||
| SelectedItem="{Binding CurrentValue}" | ||
| IsVisible="{Binding IsChoice}" | ||
| VerticalAlignment="Center" | ||
| MinHeight="0" Height="26" FontSize="12" | ||
| Margin="4,0"/> | ||
| <TextBox Text="{Binding CurrentValue}" | ||
| IsVisible="{Binding IsText}" | ||
| VerticalAlignment="Center" | ||
| Margin="4,0"/> | ||
| </Panel> | ||
| </DataTemplate> | ||
| </DataGridTemplateColumn.CellEditingTemplate> | ||
| </DataGridTemplateColumn> | ||
| <DataGridTemplateColumn Header="Default Value" IsReadOnly="True" Width="*"> | ||
| <DataGridTemplateColumn.CellTemplate> | ||
| <DataTemplate x:DataType="dialogs:FormatOptionRow"> | ||
| <Panel> | ||
| <ToggleSwitch IsChecked="{Binding DefaultBoolValue}" | ||
| IsVisible="{Binding IsBool}" | ||
| IsEnabled="False" | ||
| VerticalAlignment="Center" | ||
| Margin="4,0"/> | ||
| <TextBlock Text="{Binding DefaultValue}" | ||
| IsVisible="{Binding !IsBool}" | ||
| VerticalAlignment="Center" | ||
| Margin="8,0"/> | ||
| <!-- Choice defaults shown as text --> | ||
| </Panel> | ||
| </DataTemplate> | ||
| </DataGridTemplateColumn.CellTemplate> | ||
| </DataGridTemplateColumn> | ||
| </DataGrid.Columns> | ||
| </DataGrid> | ||
| <StackPanel Grid.Row="1" Orientation="Horizontal" HorizontalAlignment="Right" Spacing="8"> | ||
| <Button x:Name="RevertButton" Content="Revert to Default" Click="Revert_Click" | ||
| Height="32" Padding="16,0" FontSize="12" | ||
| Theme="{StaticResource AppButton}"/> | ||
| <Button x:Name="SaveButton" Content="Save" Click="Save_Click" | ||
| Height="32" Padding="16,0" FontSize="12" | ||
| Theme="{StaticResource AppButton}"/> | ||
| <Button x:Name="CloseButton" Content="Close" Click="Close_Click" | ||
| Height="32" Padding="16,0" FontSize="12" | ||
| Theme="{StaticResource AppButton}"/> | ||
| </StackPanel> | ||
| </Grid> | ||
| </Window> | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.