Skip to content

Show a run button and a highlight for each SQL statement in the editor gutter #2278

Description

@datlechin

What

Draw a run button in the editor gutter next to each SQL statement, and give the statement under the cursor a faint background.

A query tab can already hold many statements, but nothing on screen shows where one ends and the next begins. Running just one means putting the cursor in the right place and remembering a shortcut.

Why

This is the notebook-style editing people ask for: several queries in one tab, each runnable on its own. DataGrip, DBeaver and the Supabase SQL editor all do it with a plain SQL file plus a gutter affordance. The document stays a single string, so persistence, undo and autocomplete are untouched.

Scope

  • A run button on the first line of each statement. It runs that statement only.
  • A faint background over the range of the statement under the cursor.
  • Statement ranges come from SQLStatementScanner.locatedStatementAtCursor, which already handles dialects and comment-only segments.
  • The button belongs in the vendored CodeEditSourceEditor Gutter module. The editor is not an NSTextView, so NSLayoutManager decoration APIs are not available.

Not this

Real notebook cells, meaning a document made of separate cell buffers with markdown in between. That is a different document model and a different product decision.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions