Query data files in their own tab instead of overwriting the open one #7

Merged
claude-bot merged 1 commit from fix/data-file-query-own-tab into main 2026-11-20 13:38:06 +00:00
Collaborator

Problem

Double-clicking a data file (.parquet, .csv, .tsv, .json, .jsonl, .ndjson) in the explorer, or using Query Data File (LIMIT 200) from its context menu, called set_text on the active editor. That replaced whatever document was open with the generated SELECT * FROM '<file>' LIMIT 200; query.

Fix

  • New QryDuckApp::query_data_file opens the query in its own tab named after the file (e.g. sales.parquet.sql) and runs it from there. The open document isn't touched.
  • An unedited tab from an earlier query of the same file is reused, so repeated double-clicks don't pile up tabs. The untouched start-up scratch buffer is replaced, as when opening a file.
  • New SqlBuffer::generated treats the generated text as saved. The tab only becomes dirty once edited, so it doesn't trigger the unsaved-changes warning on close.
  • The query text is built by data_file_query, which is shared by the double-click and context-menu paths.

Testing

  • cargo test passes (25 tests), including new tests for quote escaping in data_file_query and for SqlBuffer::generated staying clean until edited.
  • Not yet checked by hand in the Windows GUI.

🤖 Generated with Claude Code

## Problem Double-clicking a data file (`.parquet`, `.csv`, `.tsv`, `.json`, `.jsonl`, `.ndjson`) in the explorer, or using **Query Data File (LIMIT 200)** from its context menu, called `set_text` on the active editor. That replaced whatever document was open with the generated `SELECT * FROM '<file>' LIMIT 200;` query. ## Fix - New `QryDuckApp::query_data_file` opens the query in its own tab named after the file (e.g. `sales.parquet.sql`) and runs it from there. The open document isn't touched. - An unedited tab from an earlier query of the same file is reused, so repeated double-clicks don't pile up tabs. The untouched start-up scratch buffer is replaced, as when opening a file. - New `SqlBuffer::generated` treats the generated text as saved. The tab only becomes dirty once edited, so it doesn't trigger the unsaved-changes warning on close. - The query text is built by `data_file_query`, which is shared by the double-click and context-menu paths. ## Testing - `cargo test` passes (25 tests), including new tests for quote escaping in `data_file_query` and for `SqlBuffer::generated` staying clean until edited. - Not yet checked by hand in the Windows GUI. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Double-clicking a .parquet / .csv / .tsv / .json / .jsonl / .ndjson file
(or "Query Data File" in its context menu) replaced the active
document's text with the generated SELECT preview. The query now opens
in its own tab named after the file (e.g. sales.parquet.sql) and runs
from there. An unedited tab from an earlier query of the same file is
reused, and generated tabs count as saved until edited, so they don't
trigger the unsaved-changes warning.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
claude-bot deleted branch fix/data-file-query-own-tab 2026-11-20 13:38:06 +00:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
daniel/qry-duck!7
No description provided.