Expand description
Hover information for SQL identifiers and variable references.
§Variable Hover
When the cursor is on a psql-style variable reference (:foo, :'foo',
:"foo"), resolve_variable_hover returns a tooltip showing the variable
name, its resolved value (or “undefined”), and the active profile name.
§Object Hover
When the cursor hovers over an identifier that references a database object,
resolve_hover resolves the identifier to its output schema (column names
and types) using the build artifact database and types.lock data. The result is
formatted as a Markdown table for display in the editor.
§Function Hover
If the identifier is not a project object, resolve_hover falls back to
the function registry (functions::lookup), which is derived from
mz_sql::func. Single unqualified names that match a built-in show the
function kind and one line per overload signature.
§Resolution
- Identifier parts are resolved to an
ObjectIdusing the same 1/2/3-part convention asgoto_definition::resolve_reference(). - The object is looked up in the
ProjectCache(SQLite) to confirm existence and determine its kind (view, materialized view, table, etc.). - Column schemas are retrieved via two-tier lookup:
ProjectCache(SQLite) first, thenTypes(types.lock) as fallback.
§Output
- Object with cached columns — Shows the object kind, fully-qualified
name, and a column table (name, type, nullable). If the object has a
COMMENT ONdescription, it appears as a paragraph after the header. If any column has aCOMMENT ON COLUMNdescription, aDescriptioncolumn is added to the table. - Object without cached columns — Shows just the object kind, name, and source file path.
- Unknown identifier — Returns
None.
Functions§
- resolve_
hover - Resolve hover information for an identifier.
- resolve_
variable_ hover - Resolve hover information for a variable reference at the given byte offset.