microsoft / microsoft/vscode-mssql

[Bug]: Copying SQL text in notebook editor cell causes an exception in console

Open
#21,875 1 comment 0 reactions 0 assignees View on GitHub
Area - SQL Notebook Bug User-filed
Dominant language
TypeScript
Stars
1.9k
Forks
610
Avg merge
2d 3h
Merged PRs (30d)
97

Description

### Description

When copying a SQL text segment in a notebook cell with Ctrl-C an error is generated in the console log.

```
[Error - 12:22:15 PM] Request textDocument/definition failed.
Message: Index was out of range. Must be non-negative and less than the size of the collection. (Parameter 'index')
Code: 0
```

Image

### Steps to Reproduce

1. Open SQL Notebook and type some SQL
2. Select the text and type Ctrl-C

Expected: Selected text is copied without error

Actual: An error message is displayed.

Note: This doesn't repro 100% of time, so it seems related to some other state in the cell/notebook.

### Affected Area

- [ ] Connection dialog (SQL Server | Azure browse/Fabric browse)
- [ ] 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
- [ ] Other (please describe below)

### If you selected "Other", please describe the affected area

_No response_

### Environment Information

Latest

### 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 by reproducing the Ctrl-C action in a SQL Notebook cell and capture the textDocument/definition error shown in the console. Trace the notebook editor and definition-request path involved in copying selected SQL text. Done means copying succeeds without the index-out-of-range exception, including the intermittent state described in the issue.

Written by the indexing model from the issue text.

Assessment

Tech stack
sql, typescript
Domain
databases, tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.