Skip to content

Commit 9d925cb

Browse files
htyounghantongyanggreptile-apps[bot]pernielsentikaerraycastbot
authored
Update sql-format extension (#24600)
* Update sql-format extension - Merge branch \'contributions/merge-1768644500143\' - Pull contributions - feat: support to select different SQL dialect for user * Update extensions/sql-format/CHANGELOG.md Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com> * Update * Update CHANGELOG.md and add platforms field --------- Co-authored-by: hantongyang <hantongyang@bytedance.com> Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com> Co-authored-by: Per Nielsen Tikær <per@raycast.com> Co-authored-by: raycastbot <bot@raycast.com>
1 parent 557adec commit 9d925cb

File tree

8 files changed

+172
-68
lines changed

8 files changed

+172
-68
lines changed

extensions/sql-format/.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,6 @@ compiled_raycast_swift
1111

1212
# misc
1313
.DS_Store
14+
15+
# webstorm
16+
.idea

extensions/sql-format/CHANGELOG.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,16 @@
11
# Changelog
22

3+
## [Support SQL Format Dialect] - 2026-01-22
4+
### Added New Features
5+
- Added new Preference "SQL Dialect" to select for user, the default value is "sql" as same as old
6+
7+
### Changed
8+
- upgrade sql-formatter from 15.4.0 to 15.7.0 to support ClickHouse SQL
9+
- fix some spelling error
10+
- fix autoPaste Description error, from "formatted JSON" to "formatted SQL"
11+
- add CHANGELOG for this change
12+
- add WebStorm(.idea) ignore in .gitignore file
13+
314
## [Added SQL Format Preview] - 2025-05-26
415
### Added New Features
516
- Added new command "Format SQL" for formatting SQL with visual interface.

extensions/sql-format/package-lock.json

Lines changed: 37 additions & 40 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

extensions/sql-format/package.json

Lines changed: 104 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,13 @@
22
"$schema": "https://www.raycast.com/schemas/extension.json",
33
"name": "sql-format",
44
"title": "Format SQL",
5-
"description": "Format a SQL cluase use standard SQL format",
5+
"description": "Format a SQL clause use standard SQL format",
66
"icon": "extension-icon.png",
77
"author": "tonngw",
8-
"contributors": ["stelo"],
8+
"contributors": [
9+
"stelo",
10+
"harold_han"
11+
],
912
"categories": [
1013
"Data",
1114
"Developer Tools"
@@ -15,7 +18,7 @@
1518
{
1619
"name": "formatClipboard",
1720
"title": "Format Clipboard SQL",
18-
"description": "Formats a SQL cluase string stored in clipboard and copies/pastes it back",
21+
"description": "Formats a SQL clause string stored in clipboard and copies/pastes it back",
1922
"mode": "no-view"
2023
},
2124
{
@@ -40,9 +43,9 @@
4043
"preferences": [
4144
{
4245
"default": false,
43-
"description": "Paste the formatted JSON to an active app",
44-
"label": "Automatically paste the formatted JSON",
45-
"name": "autopaste",
46+
"description": "Paste the formatted SQL to an active app",
47+
"label": "Automatically paste the formatted SQL",
48+
"name": "autoPaste",
4649
"required": false,
4750
"title": "Auto Paste",
4851
"type": "checkbox"
@@ -90,12 +93,102 @@
9093
"title": "Keyword Case",
9194
"default": "preserve",
9295
"type": "dropdown"
96+
},
97+
{
98+
"data": [
99+
{
100+
"title": "Standard SQL",
101+
"value": "sql"
102+
},
103+
{
104+
"title": "BigQuery",
105+
"value": "bigquery"
106+
},
107+
{
108+
"title": "ClickHouse",
109+
"value": "clickhouse"
110+
},
111+
{
112+
"title": "DB2",
113+
"value": "db2"
114+
},
115+
{
116+
"title": "DB2i",
117+
"value": "db2i"
118+
},
119+
{
120+
"title": "DuckDB",
121+
"value": "duckdb"
122+
},
123+
{
124+
"title": "Apache Hive",
125+
"value": "hive"
126+
},
127+
{
128+
"title": "MariaDB",
129+
"value": "mariadb"
130+
},
131+
{
132+
"title": "MySQL",
133+
"value": "mysql"
134+
},
135+
{
136+
"title": "TiDB",
137+
"value": "tidb"
138+
},
139+
{
140+
"title": "Couchbase N1QL",
141+
"value": "n1ql"
142+
},
143+
{
144+
"title": "Oracle PL/SQL",
145+
"value": "plsql"
146+
},
147+
{
148+
"title": "PostgreSQL",
149+
"value": "postgresql"
150+
},
151+
{
152+
"title": "Amazon Redshift",
153+
"value": "redshift"
154+
},
155+
{
156+
"title": "SingleStoreDB",
157+
"value": "singlestoredb"
158+
},
159+
{
160+
"title": "Snowflake",
161+
"value": "snowflake"
162+
},
163+
{
164+
"title": "Spark",
165+
"value": "spark"
166+
},
167+
{
168+
"title": "SQLite",
169+
"value": "sqlite"
170+
},
171+
{
172+
"title": "SQL Server Transact-SQL",
173+
"value": "transactsql"
174+
},
175+
{
176+
"title": "Trino",
177+
"value": "trino"
178+
}
179+
],
180+
"description": "SQL Dialect for formatting",
181+
"name": "language",
182+
"required": false,
183+
"title": "SQL Dialect",
184+
"default": "sql",
185+
"type": "dropdown"
93186
}
94187
],
95188
"dependencies": {
96189
"@raycast/api": "^1.81.2",
97190
"@raycast/utils": "^1.16.3",
98-
"sql-formatter": "^15.4.0"
191+
"sql-formatter": "^15.7.0"
99192
},
100193
"devDependencies": {
101194
"@raycast/eslint-config": "^1.0.8",
@@ -112,5 +205,8 @@
112205
"lint": "ray lint",
113206
"prepublishOnly": "echo \"\\n\\nIt seems like you are trying to publish the Raycast extension to npm.\\n\\nIf you did intend to publish it to npm, remove the \\`prepublishOnly\\` script and rerun \\`npm publish\\` again.\\nIf you wanted to publish it to the Raycast Store instead, use \\`npm run publish\\` instead.\\n\\n\" && exit 1",
114207
"publish": "npx @raycast/api@latest publish"
115-
}
208+
},
209+
"platforms": [
210+
"macOS"
211+
]
116212
}

extensions/sql-format/src/formatClipboard.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { formatSQL, copyFormattedSQL } from "./utils";
66
* If the formatted text is empty, a toast message is shown.
77
*/
88
export default async () => {
9-
const output = formatSQL((await Clipboard.readText()) || "");
9+
const output = await formatSQL((await Clipboard.readText()) || "");
1010
if (output) {
1111
await copyFormattedSQL(output);
1212
}

extensions/sql-format/src/formatSelection.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { formatSQL, copyFormattedSQL } from "./utils";
55
* Formats the selected text and copies the formatted text to the clipboard.
66
*/
77
export default async () => {
8-
const output = formatSQL(await getSelectedText());
8+
const output = await formatSQL(await getSelectedText());
99
if (output) {
1010
await copyFormattedSQL(output);
1111
}

extensions/sql-format/src/formatSqlDetail.tsx

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,12 @@ import {
1010
closeMainWindow,
1111
} from "@raycast/api";
1212

13-
interface Preferences {
14-
autopaste: boolean;
15-
}
16-
1713
/**
1814
* Component for displaying formatted SQL with copy/paste actions
1915
* @param sql - The formatted SQL string to display
2016
*/
2117
export const FormattedSqlDetail = ({ sql }: { sql: string }) => {
22-
const { autopaste } = getPreferenceValues<Preferences>();
18+
const { autoPaste } = getPreferenceValues<Preferences>();
2319

2420
// Handles copying SQL to clipboard and shows success toast
2521
const handleCopy = async () => {
@@ -35,8 +31,8 @@ export const FormattedSqlDetail = ({ sql }: { sql: string }) => {
3531
navigationTitle="Formatted SQL"
3632
actions={
3733
<ActionPanel>
38-
{autopaste && <Action.Paste title="Paste" content={sql} />}
39-
{!autopaste && <Action title="Copy to Clipboard" icon={Icon.Clipboard} onAction={handleCopy} />}
34+
{autoPaste && <Action.Paste title="Paste" content={sql} />}
35+
{!autoPaste && <Action title="Copy to Clipboard" icon={Icon.Clipboard} onAction={handleCopy} />}
4036
</ActionPanel>
4137
}
4238
/>

0 commit comments

Comments
 (0)