microsoft / microsoft/vscode-mssql
[Bug]: IntelliSense suggests SQL keywords when entering a table alias
- Dominant language
- TypeScript
- Stars
- 1.9k
- Forks
- 610
- Avg merge
- 2d 3h
- Merged PRs (30d)
- 97
Description
### Description
When aliasing a table in a SQL query, IntelliSense suggests and inserts an unrelated SQL keyword instead of respecting the alias the user is typing.
For example, while entering:
`SELECT * FROM Prices AS p`
if I type `p` and accept the completion with Enter, IntelliSense can insert `PARTIAL` instead of leaving the alias as `p`.
This appears to be incorrect context handling in IntelliSense. In an aliasing position, the editor should treat the input as an identifier/alias rather than prioritizing unrelated SQL keywords.
This issue is based on the Azure Data Studio issue https://github.com/microsoft/azuredatastudio/issues/25693.
### Steps to Reproduce
1. Open a SQL query editor connected to a database.
2. Type a query such as `SELECT * FROM Prices AS p`.
3. After typing `AS `, enter `p` for the alias.
4. Accept the IntelliSense suggestion with Enter.
### Expected Behavior
In an aliasing context:
- IntelliSense should not prioritize unrelated keywords such as `PARTIAL`
- accepting completion should preserve the intended alias identifier
- alias creation should behave as identifier entry, not keyword completion
### Actual Behavior
Typing `p` for the alias can cause IntelliSense to insert the keyword `PARTIAL` instead of keeping the alias as `p`, forcing the user to backtrack and correct the query.
### Affected Area
- Query editor
- Language service / IntelliSense behavior
### Environment Information
- VS Code Version: [fill in]
- MSSQL Extension Version: [fill in]
- Operating System: Windows
- Connection Type: SQL Server
Contributor guide
No contributing guide indexed for this repository
Research direction
Start in the query editor's language service and IntelliSense completion handling, then reproduce the issue with `SELECT * FROM Prices AS p` after typing `AS `. Trace why `PARTIAL` is selected for the alias prefix; done means accepting completion preserves `p` rather than inserting an unrelated keyword.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- sql, typescript
- Domain
- database
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 55/100