diff --git a/crates/ide-db/src/catalog.rs b/crates/ide-db/src/catalog.rs index 4484c9ad0..8982d720f 100644 --- a/crates/ide-db/src/catalog.rs +++ b/crates/ide-db/src/catalog.rs @@ -127,7 +127,10 @@ mod tests { fn schema(name: &str, tables: &[&str]) -> CatalogSchema { CatalogSchema { name: name.into(), - tables: tables.iter().map(|t| TableInfo { name: (*t).into(), kind: DbTableKind::Table }).collect(), + tables: tables + .iter() + .map(|t| TableInfo { name: (*t).into(), kind: DbTableKind::Table, comment: None }) + .collect(), } } diff --git a/crates/ide-db/src/lib.rs b/crates/ide-db/src/lib.rs index 97f82379a..dd0d836cb 100644 --- a/crates/ide-db/src/lib.rs +++ b/crates/ide-db/src/lib.rs @@ -146,6 +146,10 @@ pub struct SchemaObject { pub struct TableInfo { pub name: String, pub kind: DbTableKind, + /// The table's or view's comment; `None` when it has none, or the engine keeps no comments. + #[serde(default)] + #[specta(optional)] + pub comment: Option, } #[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize, Type)] @@ -1107,7 +1111,11 @@ impl DbManager { .filter_map(|r| { let mut it = r.into_iter(); let name = it.next().flatten()?; - Some(TableInfo { name, kind: DbTableKind::from_catalog(it.next().flatten().as_deref()) }) + Some(TableInfo { + name, + kind: DbTableKind::from_catalog(it.next().flatten().as_deref()), + comment: it.next().flatten().filter(|comment| !comment.is_empty()), + }) }) .collect()) } diff --git a/crates/ide-db/src/snowflake/meta.rs b/crates/ide-db/src/snowflake/meta.rs index 032bc5645..d44aeced7 100644 --- a/crates/ide-db/src/snowflake/meta.rs +++ b/crates/ide-db/src/snowflake/meta.rs @@ -113,7 +113,11 @@ pub(crate) async fn tables(pool: &SnowflakePool, schema: &str) -> IdeResult IdeResult &'static str { } } -/// Rows: `name, kind` where kind is `table`, `view` or `materialized view`. +/// Rows: `name, kind, comment` where kind is `table`, `view` or `materialized view`. pub fn tables(driver: DbDriver, schema: &str) -> String { match driver { DbDriver::Jdbc => unreachable!("JDBC introspection uses DatabaseMetaData"), DbDriver::Clickhouse => format!( "SELECT name, CASE engine WHEN 'View' THEN 'view' WHEN 'MaterializedView' THEN 'materialized view' \ - WHEN 'WindowView' THEN 'view' ELSE 'table' END FROM system.tables \ + WHEN 'WindowView' THEN 'view' ELSE 'table' END, comment FROM system.tables \ WHERE database = {} AND is_temporary = 0 ORDER BY name", quote_literal(driver, schema) ), DbDriver::Sqlite => format!( - "SELECT name, type FROM {}.sqlite_master WHERE type IN ('table', 'view') \ + "SELECT name, type, NULL FROM {}.sqlite_master WHERE type IN ('table', 'view') \ AND name NOT LIKE 'sqlite\\_%' ESCAPE '\\' ORDER BY name", quote_ident(driver, schema) ), DbDriver::Snowflake => format!( "SELECT table_name, CASE table_type WHEN 'VIEW' THEN 'view' WHEN 'MATERIALIZED VIEW' THEN 'materialized view' \ - ELSE 'table' END FROM information_schema.tables WHERE table_schema = {} ORDER BY 1", + ELSE 'table' END, comment FROM information_schema.tables WHERE table_schema = {} ORDER BY 1", quote_literal(driver, schema) ), DbDriver::Oracle => format!( - "SELECT table_name, 'table' FROM all_tables WHERE owner = {} \ - UNION ALL SELECT view_name, 'view' FROM all_views WHERE owner = {} ORDER BY 1", - quote_literal(driver, schema), + "SELECT table_name, CASE WHEN table_type = 'VIEW' THEN 'view' ELSE 'table' END, comments \ + FROM all_tab_comments WHERE owner = {} ORDER BY 1", quote_literal(driver, schema) ), DbDriver::Postgres => format!( - "SELECT c.relname, CASE c.relkind WHEN 'v' THEN 'view' WHEN 'm' THEN 'materialized view' ELSE 'table' END \ + "SELECT c.relname, CASE c.relkind WHEN 'v' THEN 'view' WHEN 'm' THEN 'materialized view' ELSE 'table' END, \ + obj_description(c.oid, 'pg_class') \ FROM pg_class c JOIN pg_namespace n ON n.oid = c.relnamespace \ WHERE n.nspname = {} AND c.relkind IN ('r', 'v', 'm', 'p', 'f') ORDER BY 1", quote_literal(driver, schema) ), DbDriver::Mysql => format!( - "SELECT table_name, CASE WHEN table_type LIKE '%VIEW%' THEN 'view' ELSE 'table' END \ + "SELECT table_name, CASE WHEN table_type LIKE '%VIEW%' THEN 'view' ELSE 'table' END, \ + CASE WHEN table_type LIKE '%VIEW%' THEN NULL ELSE NULLIF(table_comment, '') END \ FROM information_schema.tables WHERE table_schema = {} ORDER BY 1", quote_literal(driver, schema) ), DbDriver::SqlServer => format!( - "SELECT TABLE_NAME, CASE WHEN TABLE_TYPE LIKE '%VIEW%' THEN 'view' ELSE 'table' END \ - FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = {} ORDER BY 1", + "SELECT t.TABLE_NAME, CASE WHEN t.TABLE_TYPE LIKE '%VIEW%' THEN 'view' ELSE 'table' END, \ + CAST(ep.value AS nvarchar(max)) \ + FROM INFORMATION_SCHEMA.TABLES t \ + LEFT JOIN sys.extended_properties ep \ + ON ep.major_id = OBJECT_ID(QUOTENAME(t.TABLE_SCHEMA) + '.' + QUOTENAME(t.TABLE_NAME)) \ + AND ep.minor_id = 0 AND ep.name = 'MS_Description' \ + WHERE t.TABLE_SCHEMA = {} ORDER BY 1", quote_literal(driver, schema) ), } @@ -990,6 +996,11 @@ mod tests { assert!(columns(DbDriver::Mysql, "db", "t").contains("column_comment")); assert!(columns(DbDriver::Oracle, "S", "T").contains("all_col_comments")); assert!(columns(DbDriver::Clickhouse, "db", "t").contains("is_in_primary_key, comment")); + assert!(tables(DbDriver::Postgres, "public").contains("obj_description(c.oid, 'pg_class')")); + assert!(tables(DbDriver::Mysql, "db").contains("table_comment")); + assert!(tables(DbDriver::Oracle, "S").contains("all_tab_comments")); + assert!(tables(DbDriver::Clickhouse, "db").contains("END, comment FROM system.tables")); + assert!(tables(DbDriver::SqlServer, "dbo").contains("sys.extended_properties")); // Completion (the hover card of a table or column) carries them too, as the ninth field. let completion = |driver| completion_columns(driver, CompletionScope::All); assert!(completion(DbDriver::Postgres).contains("col_description(c.oid, a.attnum)")); @@ -1030,6 +1041,7 @@ mod tests { assert_eq!(current_schema(driver), Some("SELECT currentDatabase()")); let relations = tables(driver, "event's\\db"); assert!(relations.contains("WHEN 'MaterializedView' THEN 'materialized view'")); + assert!(relations.contains(r"END, comment FROM system.tables")); assert!(relations.contains(r"WHERE database = 'event''s\\db' AND is_temporary = 0")); let fields = columns(driver, "default", "events"); assert!(fields.starts_with("SELECT name, type, CASE WHEN startsWith(type, 'Nullable(')")); @@ -1145,6 +1157,7 @@ mod tests { #[test] fn sqlserver_introspection_queries() { assert!(tables(DbDriver::SqlServer, "dbo").contains("INFORMATION_SCHEMA.TABLES")); + assert!(tables(DbDriver::SqlServer, "dbo").contains("sys.extended_properties")); assert!(columns(DbDriver::SqlServer, "dbo", "t").contains("INFORMATION_SCHEMA.COLUMNS")); assert!(indexes(DbDriver::SqlServer, "dbo", "t").contains("sys.indexes")); assert!(foreign_keys(DbDriver::SqlServer).contains("sys.foreign_key_columns")); @@ -1221,8 +1234,10 @@ mod tests { assert_eq!(DbDriver::Oracle.default_port(), Some(1521)); assert!(schemas(DbDriver::Oracle, true).contains("all_users")); assert!(schemas(DbDriver::Oracle, false).contains("'MDSYS'")); - assert!(tables(DbDriver::Oracle, "hr").contains("all_tables")); - assert!(tables(DbDriver::Oracle, "hr").contains("all_views")); + let relations = tables(DbDriver::Oracle, "hr"); + assert!(relations.contains("all_tab_comments")); + assert!(relations.contains("table_type = 'VIEW'")); + assert!(relations.contains("comments")); let cols = columns(DbDriver::Oracle, "hr", "employees"); assert!(cols.contains("all_tab_columns")); assert!(cols.contains("DECODE(c.nullable, 'Y', 'YES', 'NO')")); diff --git a/crates/ide-db/tests/mysql.rs b/crates/ide-db/tests/mysql.rs index 50cf0136d..04f1bf587 100644 --- a/crates/ide-db/tests/mysql.rs +++ b/crates/ide-db/tests/mysql.rs @@ -57,6 +57,7 @@ async fn assert_metadata_is_text(db: &DbManager) -> IdeResult<()> { assert!(schemas.iter().any(|n| n == s), "{s} missing from {schemas:?}"); let tables = db.tables("m", s).await?; assert_eq!(tables.iter().map(|t| t.name.as_str()).collect::>(), ["用户"], "tables of {s}"); + assert_eq!(tables[0].comment.as_deref(), Some("用户表")); let d = db.table_details("m", s, "用户").await?; let cols: Vec<_> = d.columns.iter().map(|c| c.name.as_str()).collect(); assert_eq!(cols, ["id", "name", "raw"]); diff --git a/crates/ide-db/tests/postgres.rs b/crates/ide-db/tests/postgres.rs index bd86c60ca..eb253a460 100644 --- a/crates/ide-db/tests/postgres.rs +++ b/crates/ide-db/tests/postgres.rs @@ -353,6 +353,9 @@ async fn table_details_routines_and_completion_on_older_catalogs() -> IdeResult< assert_eq!(details.foreign_keys[0].ref_columns, ["region", "id"]); let orders = db.table_details("p", "oi_meta", "orders").await?; assert_eq!(orders.comment.as_deref(), Some("Customer's orders")); + let listed = db.tables("p", "oi_meta").await?; + let listed_orders = listed.iter().find(|table| table.name == "orders").expect("orders in the table list"); + assert_eq!(listed_orders.comment.as_deref(), Some("Customer's orders")); let comments: Vec<_> = orders.columns.iter().map(|c| c.comment.as_deref()).collect(); assert_eq!(comments, [None, None, Some("Free text")]); assert_eq!(details.comment, None); diff --git a/docs/en/guide/database.mdx b/docs/en/guide/database.mdx index c8978cfeb..c799ed7d0 100644 --- a/docs/en/guide/database.mdx +++ b/docs/en/guide/database.mdx @@ -93,7 +93,7 @@ The data source dialog has a name, an optional **Color:** (tints the tree and co ## Browse the database -The tree shows data source › database (PostgreSQL) › schema › `tables`, `views`, `materialized views`, `routines` and `sequences`. Tables contain `columns`, `keys`, `foreign keys`, `indexes` and `triggers`. Nodes load when you expand them. Turn on **Separate Procedures and Functions** in the tool window's options menu to split `routines`. +The tree shows data source › database (PostgreSQL) › schema › `tables`, `views`, `materialized views`, `routines` and `sequences`. Tables contain `columns`, `keys`, `foreign keys`, `indexes` and `triggers`. Nodes load when you expand them. Turn on **Separate Procedures and Functions** in the tool window's options menu to split `routines`; **Show Table Comments** shows a table's comment in grey after its name. Double-click a table to edit its data, a data source to open its console, and a routine, sequence or trigger to see its DDL. Type in **Filter objects** to filter the tree. diff --git a/docs/zh/guide/database.mdx b/docs/zh/guide/database.mdx index f4acee200..cf5b74643 100644 --- a/docs/zh/guide/database.mdx +++ b/docs/zh/guide/database.mdx @@ -93,7 +93,7 @@ description: "连接 SQL 数据库、浏览架构、在查询控制台中执行 ## 浏览数据库 -树的结构为 数据源 › 数据库(PostgreSQL)› 架构 › `tables`、`views`、`materialized views`、`routines`、`sequences`。表下面有 `columns`、`keys`、`foreign keys`、`indexes` 和 `triggers`。节点在展开时才加载。在工具窗口的选项菜单中打开 **分别显示过程和函数** 可以把 `routines` 拆开。 +树的结构为 数据源 › 数据库(PostgreSQL)› 架构 › `tables`、`views`、`materialized views`、`routines`、`sequences`。表下面有 `columns`、`keys`、`foreign keys`、`indexes` 和 `triggers`。节点在展开时才加载。在工具窗口的选项菜单中打开 **分别显示过程和函数** 可以把 `routines` 拆开;**显示表注释** 在表名后显示灰色单行注释。 双击表会编辑其数据,双击数据源会打开它的控制台,双击例程、序列或触发器会显示 DDL。在 **过滤对象** 中输入文字可以过滤树。 diff --git a/java/jdbc-bridge/openidea-jdbc-bridge.jar b/java/jdbc-bridge/openidea-jdbc-bridge.jar index 15ec29ca4..93e505356 100644 Binary files a/java/jdbc-bridge/openidea-jdbc-bridge.jar and b/java/jdbc-bridge/openidea-jdbc-bridge.jar differ diff --git a/java/jdbc-bridge/src/ai/openidea/jdbc/OpenIdeaJdbc.java b/java/jdbc-bridge/src/ai/openidea/jdbc/OpenIdeaJdbc.java index 4eb5b780a..889db01be 100644 --- a/java/jdbc-bridge/src/ai/openidea/jdbc/OpenIdeaJdbc.java +++ b/java/jdbc-bridge/src/ai/openidea/jdbc/OpenIdeaJdbc.java @@ -138,13 +138,13 @@ public final class OpenIdeaJdbc { String catalog = catalogs && !name.isEmpty() ? name : connection.getCatalog(); String schema = catalogs || name.isEmpty() ? null : pattern(m, name); if (op.equals("tables")) { - header(out, "name", "kind"); + header(out, "name", "kind", "comment"); try (ResultSet rs = m.getTables(catalog, schema, "%", null)) { int n = 0; while (rs.next() && n < 20000) { String type = rs.getString("TABLE_TYPE").toLowerCase(Locale.ROOT); if (!Set.of("table","base table","view","materialized view","system table","local temporary","foreign table").contains(type)) continue; - row(out, rs.getString("TABLE_NAME"), type); + row(out, rs.getString("TABLE_NAME"), type, rs.getString("REMARKS")); n++; } } diff --git a/java/jdbc-bridge/tests/SelfTest.java b/java/jdbc-bridge/tests/SelfTest.java index adef1cf7e..924483bb8 100644 --- a/java/jdbc-bridge/tests/SelfTest.java +++ b/java/jdbc-bridge/tests/SelfTest.java @@ -32,6 +32,8 @@ public class SelfTest { case "getIdentifierQuoteString" -> "\""; case "getSearchStringEscape" -> "\\"; case "getSchemas" -> rows(List.of(Map.of("TABLE_SCHEM", "app"))); + case "getTables" -> rows(List.of(Map.of( + "TABLE_NAME", "orders", "TABLE_TYPE", "TABLE", "REMARKS", "Orders table"))); case "getColumns" -> "app".equals(a[1]) && "%".equals(a[2]) ? rows(List.of( Map.of("TABLE_NAME", "orders", "COLUMN_NAME", "id", "TYPE_NAME", "INT", "NULLABLE", 0), Map.of("TABLE_NAME", "orders", "COLUMN_NAME", "note", "TYPE_NAME", "VARCHAR", "NULLABLE", 1, @@ -155,6 +157,9 @@ public class SelfTest { var columns = new String(reply(in), StandardCharsets.UTF_8); assert columns.contains("orders") && columns.contains("note") && columns.contains("'none'") : columns; assert columns.contains("comment") && columns.contains("free text") : columns; + send(out, 10, "tables", "app"); + var tables = new String(reply(in), StandardCharsets.UTF_8); + assert tables.contains("orders") && tables.contains("Orders table") : tables; } finally { child.destroyForcibly().waitFor(); } diff --git a/src/bindings.ts b/src/bindings.ts index fde50d434..580f41847 100644 --- a/src/bindings.ts +++ b/src/bindings.ts @@ -5791,6 +5791,8 @@ export type DbTableGrant = { export type DbTableInfo = { name: string, kind: DbTableKind, + /** The table's or view's comment; `None` when it has none, or the engine keeps no comments. */ + comment?: string | null, }; export type DbTableKind = "table" | "view" | "materializedView"; diff --git a/src/features/database/DatabaseView.test.tsx b/src/features/database/DatabaseView.test.tsx index 28a69ee40..15ce4f993 100644 --- a/src/features/database/DatabaseView.test.tsx +++ b/src/features/database/DatabaseView.test.tsx @@ -41,6 +41,7 @@ beforeEach(() => { }, }, separateProceduresAndFunctions: false, + showTableComments: true, treeExpanded: new Set(["pg", "pg/public", "pg/public/routines"]), }); }); @@ -67,6 +68,7 @@ describe("routine grouping", () => { await act(() => executeAction("db.separateProceduresAndFunctions")); expect(JSON.parse(localStorage.getItem("openidea.database.viewOptions")!)).toEqual({ separateProceduresAndFunctions: true, + showTableComments: true, }); expect(tree.queryByText("routines")).toBeNull(); const procedures = tree.getByText("procedures").closest('[role="treeitem"]')!; @@ -83,6 +85,7 @@ describe("routine grouping", () => { expect(tree.getByText("refresh_data")).toBeInTheDocument(); expect(JSON.parse(localStorage.getItem("openidea.database.viewOptions")!)).toEqual({ separateProceduresAndFunctions: false, + showTableComments: true, }); }); @@ -103,6 +106,32 @@ describe("routine grouping", () => { }); }); +describe("table comments", () => { + it("shows a table's comment after its name and hides it through the view option", async () => { + useDatabase.setState({ + tables: { + [tablesKey("pg", "public")]: { + status: "ok", + value: [{ name: "orders", kind: "table", comment: "Customer orders" }], + }, + }, + treeExpanded: new Set(["pg", "pg/public", "pg/public/tables"]), + }); + render(); + const tree = within(screen.getByRole("tree", { name: "Data sources" })); + expect(tree.getByText("Customer orders")).toBeInTheDocument(); + expect(tree.getByText("orders").closest('[role="treeitem"]')).toHaveAttribute("title", "Customer orders"); + + await act(() => executeAction("db.showTableComments")); + expect(tree.queryByText("Customer orders")).toBeNull(); + expect(tree.getByText("orders").closest('[role="treeitem"]')).not.toHaveAttribute("title"); + expect(JSON.parse(localStorage.getItem("openidea.database.viewOptions")!)).toEqual({ + separateProceduresAndFunctions: false, + showTableComments: false, + }); + }); +}); + describe("Select Opened File", () => { const nextFrame = () => act(() => new Promise((resolve) => requestAnimationFrame(() => resolve()))); let active: EditorInput | null = null; diff --git a/src/features/database/DatabaseView.tsx b/src/features/database/DatabaseView.tsx index bec8e486b..d4b219bc0 100644 --- a/src/features/database/DatabaseView.tsx +++ b/src/features/database/DatabaseView.tsx @@ -541,6 +541,11 @@ export function DatabaseView() { return `(${n.fk.columns.join(", ")}) → ${n.fk.refTable} (${n.fk.refColumns.join(", ")})`; case "index": return `${n.index.unique ? "unique " : ""}(${n.index.columns.join(", ")})`; + case "table": { + if (!st.showTableComments) return undefined; + const comment = n.table.comment?.replace(/\s+/g, " ").trim(); + return comment || undefined; + } default: return undefined; } @@ -612,6 +617,13 @@ export function DatabaseView() { loadChildren={load} getIcon={(n) => icon(n)} getDetail={detail} + getTooltip={(n) => + n.kind === "source" + ? n.source.comment || undefined + : n.kind === "table" && st.showTableComments + ? n.table.comment?.trim() || undefined + : undefined + } getColor={(n) => (n.kind === "message" && n.error ? "var(--danger)" : undefined)} rowTint={(n) => { // IDEA tints every row of a coloured data source across its full width and height. @@ -632,11 +644,14 @@ export function DatabaseView() { ? styles.keyLabel : styles.nodeLabel; const live = n.kind === "source" && [...st.connected].some((t) => splitTarget(t).id === n.source.id); + const title = + n.kind === "source" + ? n.source.comment || undefined + : n.kind === "table" && st.showTableComments + ? n.table.comment?.trim() || undefined + : undefined; return ( - + {i && ( diff --git a/src/features/database/index.ts b/src/features/database/index.ts index 74637d64d..07b842225 100644 --- a/src/features/database/index.ts +++ b/src/features/database/index.ts @@ -71,7 +71,11 @@ function consoleStartSchema(arg: unknown, id: string): string | undefined { function useDatabaseHeaderMenu(): MenuItem[] { const separate = useDatabase((s) => s.separateProceduresAndFunctions); - return [{ kind: "action", action: "db.separateProceduresAndFunctions", checked: separate }]; + const comments = useDatabase((s) => s.showTableComments); + return [ + { kind: "action", action: "db.separateProceduresAndFunctions", checked: separate }, + { kind: "action", action: "db.showTableComments", checked: comments }, + ]; } const useDialogOpen = () => useDatabase((s) => !!s.dialog); diff --git a/src/features/database/store.ts b/src/features/database/store.ts index 926bbca7b..21adab5b1 100644 --- a/src/features/database/store.ts +++ b/src/features/database/store.ts @@ -224,6 +224,7 @@ interface DatabaseState { /** Console path → its active schema (unqualified names resolve there; see `consoleSchema`). */ consoleSchemas: Record; separateProceduresAndFunctions: boolean; + showTableComments: boolean; completion: Record; results: ResultTab[]; /** Results shown in the editor under their statements (In-Editor Results), oldest first. */ @@ -275,15 +276,21 @@ function readConsoleSchemas(): Record { } } -function readSeparateProceduresAndFunctions(): boolean { +function readViewOptions(): Pick { try { const raw = localStorage.getItem(VIEW_OPTIONS_KEY); - return raw ? JSON.parse(raw)?.separateProceduresAndFunctions === true : false; + const value = raw ? (JSON.parse(raw) as Record) : {}; + return { + separateProceduresAndFunctions: value.separateProceduresAndFunctions === true, + showTableComments: value.showTableComments !== false, + }; } catch { - return false; + return { separateProceduresAndFunctions: false, showTableComments: true }; } } +const initialViewOptions = readViewOptions(); + export const useDatabase = create(() => ({ sources: [], loaded: false, @@ -297,7 +304,7 @@ export const useDatabase = create(() => ({ objects: {}, consoles: readBindings(), consoleSchemas: readConsoleSchemas(), - separateProceduresAndFunctions: readSeparateProceduresAndFunctions(), + ...initialViewOptions, completion: {}, results: [], inline: [], @@ -338,8 +345,19 @@ useDatabase.subscribe((state, previous) => { export function toggleSeparateProceduresAndFunctions() { const separateProceduresAndFunctions = !useDatabase.getState().separateProceduresAndFunctions; useDatabase.setState({ separateProceduresAndFunctions }); + saveViewOptions(); +} + +export function toggleShowTableComments() { + const showTableComments = !useDatabase.getState().showTableComments; + useDatabase.setState({ showTableComments }); + saveViewOptions(); +} + +function saveViewOptions() { + const { separateProceduresAndFunctions, showTableComments } = useDatabase.getState(); try { - localStorage.setItem(VIEW_OPTIONS_KEY, JSON.stringify({ separateProceduresAndFunctions })); + localStorage.setItem(VIEW_OPTIONS_KEY, JSON.stringify({ separateProceduresAndFunctions, showTableComments })); } catch { // Per-viewer convenience only. } diff --git a/src/features/database/treeActions.ts b/src/features/database/treeActions.ts index 9bf7f29bf..78d731a19 100644 --- a/src/features/database/treeActions.ts +++ b/src/features/database/treeActions.ts @@ -43,6 +43,7 @@ import { sourceById, tablesKey, toggleSeparateProceduresAndFunctions, + toggleShowTableComments, useDatabase, withConnection, removeSource, @@ -692,6 +693,11 @@ export function registerDatabaseTreeActions(): () => void { title: "Separate Procedures and Functions", run: toggleSeparateProceduresAndFunctions, }), + tree({ + id: "db.showTableComments", + title: "Show Table Comments", + run: toggleShowTableComments, + }), tree({ id: "db.selectOpened", title: "Select Opened File", diff --git a/src/platform/locales/text/zh.json b/src/platform/locales/text/zh.json index 7016adcb2..b0c61d709 100644 --- a/src/platform/locales/text/zh.json +++ b/src/platform/locales/text/zh.json @@ -10751,5 +10751,6 @@ "tests.test_models": "tests.test_models", "unittest": "unittest", "1 file of the report is not in this project.": "报告中有 1 个文件不在此项目中。", - "{count} files of the report are not in this project.": "报告中有 {count} 个文件不在此项目中。" + "{count} files of the report are not in this project.": "报告中有 {count} 个文件不在此项目中。", + "Show Table Comments": "显示表注释" }