Skip to content

feat(plugins): show table and column comments in sidebar and grid#1782

Open
datlechin wants to merge 2 commits into
mainfrom
worktree-feat-1771-object-comments
Open

feat(plugins): show table and column comments in sidebar and grid#1782
datlechin wants to merge 2 commits into
mainfrom
worktree-feat-1771-object-comments

Conversation

@datlechin

Copy link
Copy Markdown
Member

Summary

Surfaces database object comments in the UI (closes #1771):

  • Sidebar: a table's comment shows in dimmed text after its name, truncated, with the full text on hover.
  • Data grid: the column header tooltip includes the column comment.
  • Inspector: the right sidebar shows the table comment (data was already fetched, never displayed).

A persisted preference (default on) gates the sidebar and grid display. Toggle from View > Show Object Comments. It is intentionally not in the Settings window.

Available for MySQL and PostgreSQL. Other engines simply show no comment.

Why

Column comments were already fetched end-to-end (PluginColumnInfo.comment to ColumnInfo.comment) but dropped before reaching the grid. Table comments had no model field or fetch at all. This wires both through.

Changes

  • PluginTableInfo gains comment via a new init overload; the old init stays as @_disfavoredOverload so already-built registry plugins keep loading. Additive, no PluginKit version bump.
  • TableInfo gains comment, excluded from equality and hashing to preserve the sidebar selection-set invariant.
  • MySQL fetchTables reads TABLE_COMMENT from information_schema.TABLES (guards the view-comment quirk). PostgreSQL fetchTables left-joins pg_description on every branch.
  • Column comments thread through ParsedSchemaMetadata to TableRows.columnComments to NSTableColumn.headerToolTip.
  • New GeneralSettings.showObjectComments (default on) plus a View-menu toggle.

Testing

Tests added: TableInfo comment-ignores-identity, TableRows.columnComments, parseSchemaMetadata comment extraction, PluginTableInfo Codable, PostgreSQL fetchTables SQL.

This machine has only Command Line Tools, so I could not build, run the test suite, run swiftlint, or run scripts/check-pluginkit-abi.sh locally. Please build and run tests in Xcode. The PluginKit change is additive by the documented pattern; running the ABI script before release is still recommended.

Docs updated: mysql and postgresql database pages. CHANGELOG entry added.

Fixes #1771

@mintlify

mintlify Bot commented Jun 29, 2026

Copy link
Copy Markdown

Preview deployment for your docs. Learn more about Mintlify Previews.

Project Status Preview Updated (UTC)
TablePro 🟢 Ready View Preview Jun 29, 2026, 7:17 AM

💡 Tip: Enable Workflows to automatically generate PRs for you.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 0e3334a86a

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

tableRows: TableRows,
savedLayout: ColumnLayoutState?
) {
let columnComments = AppSettingsManager.shared.general.showObjectComments

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Include comments in the grid update signature

For the normal editable table path, columnComments are populated later by applyPhase2Metadata, after the first grid render. However, updateNSView only calls reconcileColumnPool when DataGridUpdateSnapshot changes, and that snapshot does not include either tableRows.columnComments or showObjectComments; this line is therefore only evaluated during unrelated structural updates. Opening a MySQL/PostgreSQL table renders header tooltips without the fetched comments, and toggling View > Show Object Comments leaves existing grid tooltips stale until columns/rows or another snapshot field changes.

Useful? React with 👍 / 👎.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: be2b624975

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

columnDefaults = existing.columnDefaults
columnForeignKeys = existing.columnForeignKeys
columnNullable = existing.columnNullable
columnComments = existing.columnComments

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Clear comments when schema metadata is absent

When a new result has no parsed schema metadata (for example, after previously displaying a commented table in the same tab and then running SELECT 1 AS id), this copies the prior result's columnComments into the new TableRows. The grid keys header tooltips by column name, so any matching alias inherits a stale comment from the previous table even though the result is not that object. Keep comments only when the new result is known to be for the same table/schema; otherwise clear them like fresh metadata.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1.左侧表名后可以显示表注释 2.数据表头显示字段注释

1 participant