Skip to main content

Module hover

Module hover 

Source
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

  1. Identifier parts are resolved to an ObjectId using the same 1/2/3-part convention as goto_definition::resolve_reference().
  2. The object is looked up in the ProjectCache (SQLite) to confirm existence and determine its kind (view, materialized view, table, etc.).
  3. Column schemas are retrieved via two-tier lookup: ProjectCache (SQLite) first, then Types (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 ON description, it appears as a paragraph after the header. If any column has a COMMENT ON COLUMN description, a Description column 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.