| title | Quickstart: Inline GitHub Copilot Completions in SQL Files | ||
|---|---|---|---|
| titleSuffix | MSSQL Extension for Visual Studio Code | ||
| description | Learn what GitHub Copilot inline completions (ghost text) provide in SQL files, their schema-awareness limitations, and when to use the @mssql chat participant instead. | ||
| author | rwestMSFT | ||
| ms.author | randolphwest | ||
| ms.reviewer | roblescarlos | ||
| ms.date | 06/01/2026 | ||
| ms.service | sql | ||
| ms.subservice | vs-code-sql-extensions | ||
| ms.topic | quickstart | ||
| ms.collection |
|
||
| ai-usage | ai-assisted |
Inline completions are the ghost text suggestions that appear as you type in a .sql file. They come from the GitHub Copilot model and are useful for finishing common SQL patterns while you type. This article explains what inline completions offer, their key limitation (they don't see your database schema), and when to use the @mssql chat participant for schema-aware suggestions instead.
Inline completions don't see your connected database schema. They're generated by the GitHub Copilot model directly, without access to the MSSQL extension's schema context. For schema-aware suggestions while writing SQL, use the @mssql chat participant. For the architectural reason, see How GitHub Copilot works with the MSSQL extension.
- Inline completions generate ghost text while you type in the editor.
- They're useful for generic Transact-SQL (T-SQL) patterns (joins,
SELECTclauses, common functions). - They don't reference your connected database schema.
- For schema-aware completions, use the
@mssqlchat participant instead of inline completions. - The smart action icon and Ctrl+I keyboard shortcut invoke GitHub Copilot on selected code. They complement inline completions.
[!INCLUDE get-started]
When you type in a .sql file with GitHub Copilot enabled, ghost text appears inline. Accept with Tab or Enter; ignore by continuing to type.
Inline completions are good at:
- Finishing common patterns (
SELECT * FROM,INNER JOIN ... ON,WHERE x = ?). - Completing partial identifiers you've already typed in the file.
- Generating boilerplate for well-known SQL constructs.
Inline completions are not good at:
- Using real table or column names from your database (they guess based on context).
- Respecting your database actual schema or relationships.
- Using the
@mssqlchat participant's schema context.
Visual Studio Code's inline completion application programming interface (API) is effectively single-provider for any given document. When GitHub Copilot is enabled, third-party extensions (including the MSSQL extension) can't contribute schema-aware ghost text for SQL files. Ghost text comes from the GitHub Copilot model directly.
This is platform behavior, not an MSSQL extension limitation. For the full explanation, see How GitHub Copilot works with the MSSQL extension.
For suggestions that reference your actual tables, columns, and relationships, use the @mssql chat participant. Address @mssql in chat:
@mssql Write a T-SQL query that lists customers from SalesLT.Customer
who placed an order in the last 30 days.
The chat participant includes schema metadata in the request, so suggestions reference real objects in your database.
When you select SQL in the editor, the ✨ smart action icon appears next to the selection. Select it to open a short menu:
- Modify using Copilot: Rewrite the selection with an inline recommendation.
- Explain: Get a natural-language explanation of the selected SQL.
- /doc: Generate documentation comments for the selection.
- /fix: Suggest fixes for issues in the selection.
When you select Review using GitHub Copilot, an inline recommendation appears:
:::image type="content" source="media/inline-copilot-suggestions/vscode-inline-recommendation.png" alt-text="Screenshot showing an inline recommendation from GitHub Copilot for optimizing a SQL query in Visual Studio Code." lightbox="media/inline-copilot-suggestions/vscode-inline-recommendation.png":::
Invoke GitHub Copilot inline with:
- Ctrl+I on Windows and Linux
- Cmd+I on macOS
An inline prompt box appears where you can ask questions or request modifications to your query.
:::image type="content" source="media/inline-copilot-suggestions/vscode-copilot-shortcut.png" alt-text="Screenshot of invoking GitHub Copilot using the Ctrl plus I keyboard shortcut in Visual Studio Code." lightbox="media/inline-copilot-suggestions/vscode-copilot-shortcut.png":::
| If you want to... | Use |
|---|---|
| Finish a common SQL pattern while typing | Inline completions |
| Get a schema-aware query | @mssql chat |
| Modify a highlighted query | Smart action icon |
| Have a multi-turn conversation about your schema | @mssql chat |
| Invoke GitHub Copilot on a fresh prompt inline | Ctrl+I / Cmd+I |
[!INCLUDE copilot-feedback]
- How GitHub Copilot works with the MSSQL extension
- Quickstart: Chat with the
@mssqlparticipant (ask mode) - Quickstart: Use GitHub Copilot agent mode
- Quickstart: Use custom instructions to align GitHub Copilot with your T-SQL conventions
- Limitations and known issues
- Visual Studio Code: Customize AI responses