Skip to content

Latest commit

 

History

History
114 lines (78 loc) · 5.99 KB

File metadata and controls

114 lines (78 loc) · 5.99 KB
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
data-tools
ce-skilling-ai-copilot
ai-usage ai-assisted

Quickstart: Use inline GitHub Copilot completions in SQL files

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.

Key takeaways

  • Inline completions generate ghost text while you type in the editor.
  • They're useful for generic Transact-SQL (T-SQL) patterns (joins, SELECT clauses, common functions).
  • They don't reference your connected database schema.
  • For schema-aware completions, use the @mssql chat participant instead of inline completions.
  • The smart action icon and Ctrl+I keyboard shortcut invoke GitHub Copilot on selected code. They complement inline completions.

Prerequisites

[!INCLUDE get-started]

What inline completions offer

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 @mssql chat participant's schema context.

Why inline completions aren't schema-aware

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.

Get schema-aware suggestions while writing SQL

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.

Use the smart action icon

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":::

Use keyboard shortcuts

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":::

Inline completions vs. chat: decision guide

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

Share your experience

[!INCLUDE copilot-feedback]

Related content