SQLLens.AI Docs
SQL editor

SQL autocomplete

Schema-aware IntelliSense in your .sql files: type @ channels for command libraries, pick tables and columns from live metadata, accept FK-aware JOIN … ON lines, and reuse favorites and recent queries — all bound to the connection your tab is scoped to.

Animated demo: run SQL and autocomplete in the editor.
Run, EXPLAIN, and completions in the same SQL workspace flow.
Animated demo: tree drags and builder tokens with autocomplete.
Query Builder drags complement schema-aware completions.

Overview

SQLLens.AI adds a completion provider on top of VS Code’s SQL editor. Suggestions come from your active connection (explorer tree + per-file database binding), curated command libraries, starred favorites, and execution history.

This page is the full autocomplete reference. For drag-and-drop assembly and shortcut tokens that pair with tree drags, see the Query builder guide (start with the demo storyboard).

@com — common MySQL / MariaDB commands

Type @com at the start of a line (or after ;) to open the command catalog. Keep typing to filter — matching letters highlight in the list. Each row shows the channel tag and engine on the right (for example @com · MySQL / MariaDB).

Autocomplete list after typing @com: Show Full Processlist, session sql_mode, USE database, SHOW tables, autocommit, foreign_key_checks, SET NAMES, time_zone.
Command channel — session utilities, metadata helpers, and charset/time zone snippets.

@dba — same library, DBA-oriented filter

@dba is an alias for the command channel — ideal for process lists, session settings, and maintenance templates DBAs reach for daily.

Autocomplete after @dba with the same command catalog filtered for DBA workflows.
@dba opens the same family of pre-built statements as @com; use whichever tag matches your muscle memory.

After the channel tag, add words to narrow the list. Example: @dba long RunningQueryCount surfaces long-running query diagnostics (labels show engine/version hints such as MySQL 5.7+ or InnoDB).

Filtered autocomplete for @dba long RunningQueryCount showing Long Running Queries templates.
Multi-word filtering inside an @ channel — no need to memorize exact catalog titles.

Accept a catalog row → full SQL

Pick a row with Enter or Tab. The entire @… prefix is replaced by the stored SQL (multi-line templates insert as one action).

Editor after accepting Show Full Processlist: formatted SELECT from information_schema.processlist with WHERE and ORDER BY.
Accepted command — ready to run with ▶ Run SQL or tweak predicates first.

Schema columns & functions

After SELECT and table references, invoke completions for qualified columns (with data types in the detail column) plus common functions (COUNT, CONCAT, DATE_ADD, …). Use this together with JOIN ON suggestions.

Column autocomplete for dept_no and dept_name plus SQL functions after SELECT in a join query.
Column + function list while building a projection — cube icon for columns, bracket icon for functions.

Connection & active database

Completions reflect the database your SQL tab is bound to. If the tree Active badge and the editor disagree, you may see valid but unexpected object names.

How to open & navigate the list

ActionWindows / LinuxmacOS (typical)
Open suggest widget (implicit)Keep typing when VS Code Quick Suggestions are enabled
Force completionsCtrl+Space⌃+Space or ⌘+Space (keymap-dependent)
Move selection↑ ↓
Accept highlighted rowEnter or Tab
Next snippet placeholderTab (after accepting a snippet row)
Dismiss listEsc
Filter as you typeMore characters narrow matches; labels show category (table, column, favorite, @ channel, …)
Comments

Inside --, #, or /* */ comments, SQLLens.AI does not offer SQL completions (string and backtick literals are respected).

Editor run shortcuts (separate from the completion widget): see Keyboard shortcuts — for example Ctrl+Enter to run the statement under the caret.

@ mention channels (command palette in the editor)

Type @ followed by a channel keyword, then optional filter text. The list replaces the whole @… span when you accept a row. Channels are progressive: @f → @fa → @fav works letter-by-letter without typing the full word.

Channel reference

Type thisAlso worksWhat appears
@com@command, @cmd, @sql, @cPre-built MySQL/MariaDB (and engine-specific) command library — session, metadata, maintenance
@dba(alias of command channel)Same catalog; use for DBA runbooks (processlist, long queries, locks, …)
@fav@favorite, @favorites, @fYour starred SQL from the Favorites panel
@history@his, @hRecently executed queries on this connection
@fre@frequent, @frequentlyMost-run queries (execution count) for this connection
@query@qBlend of frequent + recent templates
@syntax@syn, @sSyntax pattern templates (SELECT/INSERT shapes, …)
@table@tblTables & views from live metadata
@column@colColumn names (schema-scoped)
@index@idxIndex-related snippets and objects
@explain@expEXPLAIN / analyze variants
@ddl—CREATE / ALTER / DROP / TRUNCATE templates
@dml—SELECT / INSERT / UPDATE / DELETE templates
@grant@permUser & privilege helpers
@lock@blkLock & blocking diagnostics
@repl@replication, @repReplication status & troubleshooting
@snippet@snipCurated multi-line snippets
@err@lastHelp tied to the last session error
@pin@starPinned / starred catalog entries
Examples
  • @com process — narrow to processlist-related commands
  • @dba long — long-running query diagnostics
  • @fav payroll — starred snippets whose name or shortcut matches
  • @history employees — past runs touching the employees table

Slash shortcuts (/history, /fav)

At statement start you can also type progressive slash paths:

Autocomplete vs Query Builder

Autocomplete (this page)Query Builder
GestureType; pick from the list (Enter / Tab)Optional token at line end, then drag table/column from tree
Best forSpelling identifiers, @ libraries, JOIN ON, reusing SQLMulti-clause scaffolds, clause-aware drops, FK dialogs
OverlapTokens like SE, LJ, WH appear as hintsSame tokens expect a drag to finish the builder flow

What feeds the completion list

Suggestions are merged from several sources (specialized rows first, then schema objects):

  1. @ mention channels — when an @ or / mention is active, that channel owns the list.
  2. Query Builder token hints — two-or-more-letter shortcuts (SE, LJ, WH, …) that pair with tree drags; accepting inserts text only.
  3. Table aliases — AS alias after FROM / JOIN.
  4. JOIN patterns & ON lines — FK metadata, learned joins, confidence-ranked predicates.
  5. Favorites — starred snippets (★); shortcuts you configured match too.
  6. Frequent & recent — queries you actually ran on this connection.
  7. Diagnostic templates — health, locks, replication, space (labeled as templates).
  8. Engine command library — large version-aware catalog (MySQL/MariaDB, PostgreSQL, SQLite each ship their own set).
  9. Schema layer — tables, views, columns, INSERT column lists, DDL/DML fragments, SQL keywords.

Library rows with the same visible title dedupe — your ⭐ User Favorite wins over a generic catalog twin.

JOIN targets & ON conditions

After JOIN (or while choosing the next table), completions can insert:

Suggestions blend foreign-key edges, cached successful joins, and column-name bridges. Multiple valid paths may appear — pick the one that matches your data model (bridge tables vs direct FK).

Optional workspace setting skyline-mysql.joinCompletions.showDeptEmpSubqueryBridge adds an employees sample-db bridge path between employees and departments (off by default).

Favorites, frequent & recent

Starred favorites

Frequent & recent (automatic)

Query Builder tokens in the list

When you start a statement with two or more letters, autocomplete may show drag-and-drop hints (icons such as 📥 🔍 ✏️). These reinforce the same vocabulary as Query Builder shortcuts — for example:

TokenIntent (after you drag from tree)
SE, SEL, SELECTSELECT scaffold
IN, INS, INSERTINSERT scaffold
UP, UPDATEUPDATE scaffold
DE, DELETEDELETE scaffold
LJ, IJ, RJ, CJLEFT / INNER / RIGHT / CROSS JOIN extension
WH, WL, WI, WBWHERE / LIKE / IN / BETWEEN column predicates
CR, CREATE, CTCREATE TABLE patterns
EXP, EXPLAINEXPLAIN SELECT helper

Single-letter builder shortcuts (s, d, …) still work for drags but do not appear in the completion list — see clause-letter shortcuts.

Settings that affect autocomplete

Setting (VS Code)Effect
editor.quickSuggestionsControls implicit completion while typing (VS Code core)
editor.suggestOnTriggerCharactersWhether . and similar trigger the widget
editor.tabCompletionTab accepts suggestions when on
skyline-mysql.joinCompletions.showDeptEmpSubqueryBridgeExtra bridge join suggestion on sample employees DB

Full settings index: Editor & drag-and-drop.

Troubleshooting