Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/vs/editor/common/cursor/cursor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -466,7 +466,7 @@ export class CursorsController extends Disposable {

public executeEdits(eventsCollector: ViewModelEventsCollector, source: string | null | undefined, edits: IIdentifiedSingleEditOperation[], cursorStateComputer: ICursorStateComputer, reason: TextModelEditSource): void {
let autoClosingIndices: [number, number][] | null = null;
if (source === 'snippet') {
if (source === 'snippet' || source === 'suggest') {
autoClosingIndices = this._findAutoClosingPairs(edits);
}

Expand Down
20 changes: 20 additions & 0 deletions src/vs/editor/test/browser/controller/cursor.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5759,6 +5759,26 @@ suite('Editor Controller', () => {
});
});

test('issue #315131 - Completion-inserted () tracked as auto-closed pair when source is suggest', () => {
usingCursor({
text: [
'math.fl'
],
languageId: autoClosingLanguageId
}, (editor, model, viewModel) => {
viewModel.setSelections('test', [new Selection(1, 8, 1, 8)]);

// Simulate a suggest completion that inserts 'floor()' with cursor between parens
viewModel.executeEdits('suggest', [{ range: new Range(1, 6, 1, 8), text: 'floor()' }], () => [new Selection(1, 11, 1, 11)], EditSources.suggest({ providerId: undefined }));
assert.strictEqual(model.getLineContent(1), 'math.floor()');
assertCursor(viewModel, new Position(1, 11));

// Backspace should delete both parens since they are tracked as an auto-closed pair
editor.runCommand(CoreEditingCommands.DeleteLeft, null);
assert.strictEqual(model.getLineContent(1), 'math.floor');
});
});

test('issue #78833 - Add config to use old brackets/quotes overtyping', () => {
usingCursor({
text: [
Expand Down