microsoft / microsoft/vscode-mssql
[Bug]: Go to Definition (F12) opens existing stored procedures as CREATE instead of ALTER
- Dominant language
- TypeScript
- Stars
- 1.9k
- Forks
- 610
- Avg merge
- 2d 3h
- Merged PRs (30d)
- 97
Description
### Description
## Description
Using Go to Definition (F12) on an existing stored procedure opens its definition as:
```sql
CREATE PROCEDURE dbo.ExistingProcedure
```
Because the procedure already exists, executing this script fails. An editable definition should use:
```sql
ALTER PROCEDURE dbo.ExistingProcedure
```
### Steps to Reproduce
## Steps to reproduce
1. Connect a SQL document to a database.
2. Write or locate a reference to an existing stored procedure.
3. Place the cursor on the procedure name.
4. Press F12.
5. Inspect the generated definition document.
## Actual behavior
The generated document starts with `CREATE PROCEDURE`.
## Expected behavior
The generated document should start with `ALTER PROCEDURE`, because the procedure already exists.
The same principle should apply to existing functions.
### Affected Area
- [ ] Connection dialog (SQL Server | Azure browse/Fabric browse)
- [x] Query editor
- [ ] Query results panel
- [ ] Object Explorer
- [ ] GitHub Copilot integration
- [ ] Preview/Edit data
- [ ] Table Designer
- [ ] Schema Designer
- [ ] Schema Compare
- [ ] Local SQL Server Container provisioning
- [ ] SQL database in Fabric provisioning
- [ ] DACPAC/BACPAC export/import
- [ ] SQL Database projects
- [ ] Query Plan Visualizer
- [x] Other (please describe below)
### If you selected "Other", please describe the affected area
Go to Definition (F12) for existing stored procedures.
### Environment Information
- OS: Windows
- MSSQL extension: 1.45.1
- VS Code version: 1.138
### Confirmation
- [x] I have searched existing issues and couldn't find a match
- [ ] I want to work on this issue
Contributor guide
No contributing guide indexed for this repository
Research direction
Start at the TypeScript implementation of Go to Definition (F12) for stored procedures and functions; trace how the generated definition document chooses CREATE. Verify the generated document for existing procedures and functions, and confirm its opening statement is ALTER while other behavior remains intact.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- sql, typescript
- Domain
- database, developer-experience
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 68/100