Skip to content

Commit fc23c44

Browse files
authored
docs(favorites): catch up on linked SQL folders v1.1 (#1001)
1 parent 7b4012a commit fc23c44

4 files changed

Lines changed: 54 additions & 16 deletions

File tree

docs/features/autocomplete.mdx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,10 @@ WHERE date_column > | -- NOW(), CURRENT_DATE, etc.
137137
/>
138138
</Frame>
139139

140+
### Favorite Keywords
141+
142+
Favorites you've assigned a keyword to (DB-stored or linked-file `@keyword` frontmatter) appear in the popup as a top-priority match. Type the keyword, accept the suggestion, and the favorite's full SQL replaces the keyword inline. See [SQL Favorites](/features/sql-favorites) for how to assign keywords.
143+
140144
### Schema Names
141145

142146
For databases with multiple schemas (PostgreSQL):

docs/features/icloud-sync.mdx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ TablePro syncs your connections, groups, settings, and SSH profiles across all y
1515
| **Passwords** | Optional | Opt-in via iCloud Keychain (end-to-end encrypted) |
1616
| **Groups & Tags** | Yes | Full connection organization, including nested group hierarchy (parent-child relationships and sort order) |
1717
| **App Settings** | Yes | All settings categories (General, Appearance, Editor, Keyboard, AI, Terminal) |
18+
| **Linked SQL Folders** | No | Folder paths are per-Mac. Link the same Git repo on each Mac after cloning. Cached file metadata (`linked_sql_index.db`) is also local. |
1819

1920
<Note>
2021
Passwords are not synced by default. Enable **Password sync** under the Connections toggle to sync passwords via Apple's iCloud Keychain (end-to-end encrypted). With password sync off, you need to enter the password once on each new Mac.

docs/features/sql-editor.mdx

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -294,3 +294,17 @@ The title bar shows the filename for file-backed tabs. A dot appears on the clos
294294
When a tab has both unsaved file changes and pending data grid edits, `Cmd+S` saves the data grid changes first. Save the file after the grid save completes.
295295
</Note>
296296

297+
### External modifications
298+
299+
If a file changes on disk while it's open in TablePro (a `git pull`, an edit in VS Code, etc.), a yellow banner appears above the editor with a one-click **Reload from Disk**. Reload pulls the new content in and discards your tab edits.
300+
301+
If you save (`Cmd+S`) while the file has changed externally, TablePro shows a side-by-side diff sheet with line-level highlighting and three actions:
302+
303+
- **Keep My Changes** writes your tab content back, overwriting the external edits.
304+
- **Reload from Disk** drops your edits and loads the external version.
305+
- **Cancel** closes the sheet without saving so you can copy parts out manually.
306+
307+
### Linked folders
308+
309+
For watching a whole folder of `.sql` files (e.g., a Git repo of team queries), use [Linked SQL Folders](/features/sql-favorites#linked-sql-folders) instead of opening each file by hand. Linked folders update the sidebar within a second of any on-disk change.
310+

docs/features/sql-favorites.mdx

Lines changed: 35 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -72,21 +72,30 @@ Set the scope when creating or editing a favorite.
7272

7373
## Linked SQL Folders
7474

75-
Point TablePro at a folder of `.sql` files on disk and they appear in the Favorites sidebar as read-from-disk items. Useful for teams sharing a Git repo of queries: anyone with the repo cloned can add the folder, and edits are picked up live.
75+
Link a folder of `.sql` files on disk and they show up in the Favorites sidebar live. Useful for a Git repo of shared queries: clone the repo, link the folder, the team's queries appear next to your DB-stored favorites.
7676

77-
**Adding a folder**: in the Favorites sidebar, click the **+** button at the bottom and pick **Add Linked SQL Folder...** Pick any folder containing `.sql` files. Subfolders are watched recursively. You can add as many folders as you want.
77+
### Adding a folder
7878

79-
**Managing folders**: right-click on a linked folder root in the sidebar to disable, reload, copy its path, show in Finder, or remove it from the sidebar. Removing only unlinks the folder. Files on disk are not deleted.
79+
In the Favorites sidebar, click the `+` at the bottom and choose **Add Linked SQL Folder...** Pick any folder. Subfolders nest in the sidebar in the same shape as on disk. Add as many folders as you want, and assign each one to a specific connection or leave it global.
8080

81-
**Live updates**: Drop a new file into the folder and it appears within a second. Edit a file outside TablePro (vim, VS Code, `git pull`) and the sidebar refreshes automatically.
81+
To set the scope, right-click an existing linked folder and use **Add Another SQL Folder...** to add more, or open Settings > Editor > Linked SQL Folders to toggle which connection each folder belongs to. Global folders show in every connection's Favorites tab. Per-connection folders show only when that connection is active.
8282

83-
**Editing**: Click a linked file to open it as a regular editor tab. ⌘S writes back to disk. If the file was modified externally since you opened it, ⌘S shows a prompt with **Keep My Changes** / **Reload from Disk** / **Cancel**.
83+
### Editing files
8484

85-
**Deleting**: Press Delete on a linked file or right-click > **Move File to Trash**. The file goes to macOS Trash, recoverable from Finder.
85+
Click a linked file to open it as a regular editor tab. `Cmd+S` writes back to disk in the file's original encoding. UTF-8, UTF-16, ISO Latin-1 and a few others are auto-detected on load and preserved on save.
86+
87+
If the file was modified outside TablePro since you opened it, two things happen:
88+
89+
- A yellow banner appears above the editor with a one-click **Reload from Disk**.
90+
- If you save anyway, TablePro shows a side-by-side diff sheet with **Keep My Changes**, **Reload from Disk**, and **Cancel**.
91+
92+
External edits propagate to the sidebar within about a second via FSEvents. Drop a new file into the folder and it appears. Delete a file in Finder and the row disappears. `git pull` triggers the same refresh.
93+
94+
Non-UTF-8 files show a yellow warning triangle in the sidebar. Saving works in their native encoding. If you type a character that doesn't fit (e.g., an emoji into ISO Latin-1), the save fails with a clear error so you don't silently lose data.
8695

8796
### Frontmatter
8897

89-
Add metadata as leading SQL comments. The parser stops at the first non-matching line, so put frontmatter at the very top:
98+
Top-of-file SQL comments set the display name, autocomplete keyword, and tooltip:
9099

91100
```sql
92101
-- @name: Active Users (24h)
@@ -97,21 +106,31 @@ FROM users
97106
WHERE last_seen > NOW() - INTERVAL 24 HOUR;
98107
```
99108

100-
| Key | Description |
101-
|-----|-------------|
102-
| `@name` | Display name in the sidebar. Falls back to filename without `.sql`. |
103-
| `@keyword` | Autocomplete keyword. Type it in the editor to expand the file content as a query. |
104-
| `@description` | Optional description, shown in tooltips. |
109+
| Key | Effect |
110+
|-----|--------|
111+
| `@name` | Display name in the sidebar. Falls back to the filename without `.sql`. |
112+
| `@keyword` | Autocomplete trigger. Type the keyword in the editor and the file content expands as a query. |
113+
| `@description` | Optional. Shown in tooltips. |
114+
115+
The parser stops at the first non-frontmatter line, so put these at the very top of the file. UTF-8 BOM at the start of the file is handled. Files without frontmatter still appear, with the filename as the display name and no keyword registered.
105116

106-
Files without frontmatter still show up. The filename becomes the display name and no keyword is registered.
117+
To edit frontmatter without opening the file, right-click a linked row and choose **Edit Metadata...** The dialog rewrites only the leading comment block and preserves the rest of the file plus its original encoding.
107118

108-
### Folder scope
119+
### Drag and drop
109120

110-
In the future, linked folders can be scoped per-connection (so each project repo is only visible when its database is selected). Today all linked folders are global.
121+
Drag a row from the Favorites sidebar (linked or DB-stored) onto the SQL editor to insert its content at the cursor.
122+
123+
### Removing files and folders
124+
125+
Press Delete on a linked file or right-click > **Move File to Trash**. The file goes to the macOS Trash and stays recoverable from Finder.
126+
127+
Right-click a linked folder root for **Disable**, **Reload**, **Copy Path**, **Show in Finder**, **Add Another SQL Folder...**, or **Remove from Sidebar**. Removing only unlinks the folder from TablePro. Files on disk stay where they are.
111128

112129
### Storage
113130

114-
Linked folder paths are stored in UserDefaults (key `com.TablePro.linkedSQLFolders`). Parsed file metadata (name, keyword, mtime, size, encoding) is cached in `linked_sql_index.db` in `~/Library/Application Support/TablePro/` for fast sidebar rendering. The actual file content always lives on disk.
131+
Linked folder paths live in UserDefaults under `com.TablePro.linkedSQLFolders`. Parsed metadata (name, keyword, mtime, size, encoding) is cached in `linked_sql_index.db` under `~/Library/Application Support/TablePro/` so the sidebar renders without re-reading every file. File content always lives on disk.
132+
133+
Linked folder paths are not part of iCloud Sync. Each Mac links its own copy of a shared repo.
115134

116135
## Storage
117136

0 commit comments

Comments
 (0)