Change:
<ins> /*--------------------------------------------------------------------------------------------- *  Copyright (c) Microsoft Corporation. All rights reserved. *  Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ import assert = require('assert'); import { RangeMap, intersect, groupIntersect, IRangedGroup, consolidate } from '../rangeMap'; suite('RangeMap', () => { var rangeMap: RangeMap; setup(() => { rangeMap = new RangeMap(); }); teardown(() => { rangeMap.dispose(); }); test('intersection', () => { assert.deepEqual(intersect({ start: 0, end: 0 }, { start: 0, end: 0 }), null); assert.deepEqual(intersect({ start: 0, end: 0 }, { start: 5, end: 5 }), null); assert.deepEqual(intersect({ start: 0, end: 1 }, { start: 5, end: 6 }), null); assert.deepEqual(intersect({ start: 5, end: 6 }, { start: 0, end: 1 }), null); assert.deepEqual(intersect({ start: 0, end: 5 }, { start: 2, end: 2 }), null); assert.deepEqual(intersect({ start: 0, end: 1 }, { start: 0, end: 1 }), { start: 0, end: 1 }); assert.deepEqual(intersect({ start: 0, end: 10 }, { start: 0, end: 5 }), { start: 0, end: 5 }); assert.deepEqual(intersect({ start: 0, end: 5 }, { start: 0, end: 10 }), { start: 0, end: 5 }); assert.deepEqual(intersect({ start: 0, end: 10 }, { start: 5, end: 10 }), { start: 5, end: 10 }); assert.deepEqual(intersect({ start: 5, end: 10 }, { start: 0, end: 10 }), { start: 5, end: 10 }); assert.deepEqual(intersect({ start: 0, end: 10 }, { start: 2, end: 8 }), { start: 2, end: 8 }); assert.deepEqual(intersect({ start: 2, end: 8 }, { start: 0, end: 10 }), { start: 2, end: 8 }); assert.deepEqual(intersect({ start: 0, end: 10 }, { start: 5, end: 15 }), { start: 5, end: 10 }); assert.deepEqual(intersect({ start: 5, end: 15 }, { start: 0, end: 10 }), { start: 5, end: 10 }); }); test('multiIntersect', () => { assert.deepEqual( groupIntersect( { start: 0, end: 0 }, [{ range: { start: 0, end: 10 }, size: 1 }] ), [] ); assert.deepEqual( groupIntersect( { start: 10, end: 20 }, [{ range: { start: 0, end: 10 }, size: 1 }] ), [] ); assert.deepEqual( groupIntersect( { start: 2, end: 8 }, [{ range: { start: 0, end: 10 }, size: 1 }] ), [{ range: { start: 2, end: 8 }, size: 1 }] ); assert.deepEqual( groupIntersect( { start: 2, end: 8 }, [{ range: { start: 0, end: 10 }, size: 1 }, { range: { start: 10, end: 20 }, size: 5 }] ), [{ range: { start: 2, end: 8 }, size: 1 }] ); assert.deepEqual( groupIntersect( { start: 12, end: 18 }, [{ range: { start: 0, end: 10 }, size: 1 }, { range: { start: 10, end: 20 }, size: 5 }] ), [{ range: { start: 12, end: 18 }, size: 5 }] ); assert.deepEqual( groupIntersect( { start: 2, end: 18 }, [{ range: { start: 0, end: 10 }, size: 1 }, { range: { start: 10, end: 20 }, size: 5 }] ), [{ range: { start: 2, end: 10 }, size: 1 }, { range: { start: 10, end: 18 }, size: 5 }] ); assert.deepEqual( groupIntersect( { start: 2, end: 28 }, [{ range: { start: 0, end: 10 }, size: 1 }, { range: { start: 10, end: 20 }, size: 5 }, { range: { start: 20, end: 30 }, size: 10 }] ), [{ range: { start: 2, end: 10 }, size: 1 }, { range: { start: 10, end: 20 }, size: 5 }, { range: { start: 20, end: 28 }, size: 10 }] ); }); test('consolidate', () => { assert.deepEqual(consolidate([]), []); assert.deepEqual( consolidate([{ range: { start: 0, end: 10 }, size: 1 }]), [{ range: { start: 0, end: 10 }, size: 1 }] ); assert.deepEqual( consolidate([ { range: { start: 0, end: 10 }, size: 1 }, { range: { start: 10, end: 20 }, size: 1 } ]), [{ range: { start: 0, end: 20 }, size: 1 }] ); assert.deepEqual( consolidate([ { range: { start: 0, end: 10 }, size: 1 }, { range: { start: 10, end: 20 }, size: 1 }, { range: { start: 20, end: 100 }, size: 1 } ]), [{ range: { start: 0, end: 100 }, size: 1 }] ); assert.deepEqual( consolidate([ { range: { start: 0, end: 10 }, size: 1 }, { range: { start: 10, end: 20 }, size: 5 }, { range: { start: 20, end: 30 }, size: 10 } ]), [ { range: { start: 0, end: 10 }, size: 1 }, { range: { start: 10, end: 20 }, size: 5 }, { range: { start: 20, end: 30 }, size: 10 } ] ); assert.deepEqual( consolidate([ { range: { start: 0, end: 10 }, size: 1 }, { range: { start: 10, end: 20 }, size: 2 }, { range: { start: 20, end: 100 }, size: 2 } ]), [ { range: { start: 0, end: 10 }, size: 1 }, { range: { start: 10, end: 100 }, size: 2 } ] ); }); test('empty', () => { assert.equal(rangeMap.size, 0); assert.equal(rangeMap.count, 0); }); test('length & count', () => { rangeMap.splice(0, 0, { count: 1, size: 1 }); assert.equal(rangeMap.size, 1); assert.equal(rangeMap.count, 1); }); test('length & count #2', () => { rangeMap.splice(0, 0, { count: 5, size: 1 }); assert.equal(rangeMap.size, 5); assert.equal(rangeMap.count, 5); }); test('length & count #3', () => { rangeMap.splice(0, 0, { count: 1, size: 5 }); assert.equal(rangeMap.size, 5); assert.equal(rangeMap.count, 1); }); test('length & count #4', () => { rangeMap.splice(0, 0, { count: 5, size: 5 }); assert.equal(rangeMap.size, 25); assert.equal(rangeMap.count, 5); }); test('insert', () => { rangeMap.splice(0, 0, { count: 5, size: 5 }); assert.equal(rangeMap.size, 25); assert.equal(rangeMap.count, 5); rangeMap.splice(0, 0, { count: 5, size: 5 }); assert.equal(rangeMap.size, 50); assert.equal(rangeMap.count, 10); rangeMap.splice(5, 0, { count: 2, size: 10 }); assert.equal(rangeMap.size, 70); assert.equal(rangeMap.count, 12); rangeMap.splice(12, 0, { count: 1, size: 200 }); assert.equal(rangeMap.size, 270); assert.equal(rangeMap.count, 13); }); test('delete', () => { rangeMap.splice(0, 0, { count: 20, size: 5 }); assert.equal(rangeMap.size, 100); assert.equal(rangeMap.count, 20); rangeMap.splice(10, 5); assert.equal(rangeMap.size, 75); assert.equal(rangeMap.count, 15); rangeMap.splice(0, 1); assert.equal(rangeMap.size, 70); assert.equal(rangeMap.count, 14); rangeMap.splice(1, 13); assert.equal(rangeMap.size, 5); assert.equal(rangeMap.count, 1); rangeMap.splice(1, 1); assert.equal(rangeMap.size, 5); assert.equal(rangeMap.count, 1); }); test('insert & delete', () => { assert.equal(rangeMap.size, 0); assert.equal(rangeMap.count, 0); rangeMap.splice(0, 0, { count: 1, size: 1 }); assert.equal(rangeMap.size, 1); assert.equal(rangeMap.count, 1); rangeMap.splice(0, 1); assert.equal(rangeMap.size, 0); assert.equal(rangeMap.count, 0); }); test('insert & delete #2', () => { rangeMap.splice(0, 0, { count: 10, size: 1 }); rangeMap.splice(2, 6); assert.equal(rangeMap.count, 4); assert.equal(rangeMap.size, 4); }); test('insert & delete #3', () => { rangeMap.splice(0, 0, { count: 10, size: 1 }, { count: 10, size: 2 }); rangeMap.splice(8, 4); assert.equal(rangeMap.count, 16); assert.equal(rangeMap.size, 24); }); test('insert & delete #3', () => { rangeMap.splice(0, 0, { count: 10, size: 1 }, { count: 10, size: 2 }); rangeMap.splice(5, 0, { count: 5, size: 3 }); assert.equal(rangeMap.count, 25); assert.equal(rangeMap.size, 45); rangeMap.splice(4, 7); assert.equal(rangeMap.count, 18); assert.equal(rangeMap.size, 28); }); suite('indexAt, positionAt', () => { test('empty', () => { assert.equal(rangeMap.indexAt(0), -1); assert.equal(rangeMap.indexAt(10), -1); assert.equal(rangeMap.indexAt(-1), -1); assert.equal(rangeMap.positionAt(0), -1); assert.equal(rangeMap.positionAt(10), -1); assert.equal(rangeMap.positionAt(-1), -1); }); test('simple', () => { rangeMap.splice(0, 0, { count: 1, size: 1 }); assert.equal(rangeMap.indexAt(0), 0); assert.equal(rangeMap.indexAt(1), -1); assert.equal(rangeMap.positionAt(0), 0); assert.equal(rangeMap.positionAt(1), -1); }); test('simple #2', () => { rangeMap.splice(0, 0, { count: 1, size: 10 }); assert.equal(rangeMap.indexAt(0), 0); assert.equal(rangeMap.indexAt(5), 0); assert.equal(rangeMap.indexAt(9), 0); assert.equal(rangeMap.indexAt(10), -1); assert.equal(rangeMap.positionAt(0), 0); assert.equal(rangeMap.positionAt(1), -1); }); test('insert', () => { rangeMap.splice(0, 0, { count: 10, size: 1 }); assert.equal(rangeMap.indexAt(0), 0); assert.equal(rangeMap.indexAt(1), 1); assert.equal(rangeMap.indexAt(5), 5); assert.equal(rangeMap.indexAt(9), 9); assert.equal(rangeMap.indexAt(10), -1); rangeMap.splice(10, 0, { count: 10, size: 1 }); assert.equal(rangeMap.indexAt(10), 10); assert.equal(rangeMap.indexAt(19), 19); assert.equal(rangeMap.indexAt(20), -1); assert.equal(rangeMap.positionAt(0), 0); assert.equal(rangeMap.positionAt(1), 1); assert.equal(rangeMap.positionAt(19), 19); assert.equal(rangeMap.positionAt(20), -1); }); test('delete', () => { rangeMap.splice(0, 0, { count: 10, size: 1 }); rangeMap.splice(2, 6); assert.equal(rangeMap.indexAt(0), 0); assert.equal(rangeMap.indexAt(1), 1); assert.equal(rangeMap.indexAt(3), 3); assert.equal(rangeMap.indexAt(4), -1); assert.equal(rangeMap.positionAt(0), 0); assert.equal(rangeMap.positionAt(1), 1); assert.equal(rangeMap.positionAt(3), 3); assert.equal(rangeMap.positionAt(4), -1); }); test('delete #2', () => { rangeMap.splice(0, 0, { count: 10, size: 10 }); rangeMap.splice(2, 6); assert.equal(rangeMap.indexAt(0), 0); assert.equal(rangeMap.indexAt(1), 0); assert.equal(rangeMap.indexAt(30), 3); assert.equal(rangeMap.indexAt(40), -1); assert.equal(rangeMap.positionAt(0), 0); assert.equal(rangeMap.positionAt(1), 10); assert.equal(rangeMap.positionAt(2), 20); assert.equal(rangeMap.positionAt(3), 30); assert.equal(rangeMap.positionAt(4), -1); }); }); }); </ins>  No newline at end of file

Discussion:
VSCode Version: 0.10.11 OS Version: Win10 Steps to Reproduce: this key binding: a code file (C#, JS, TS) "publ" followed by the space key Expected: The text should be (with a space at the end) Actual: The text is , no autocompletion occurred. Note: "acceptSelectedSuggestion" without the caret still works
Looking thru the default bindings, I noticed this binding at the very bottom of the file: Pressing does not autocomplete in TypeScript either.
I can confirm it doesn't work on TypeScript due to the context key not being set.
There is two problems: commit introduced a regression in that it turns around the boolean condition (missing ) ended up with having the command two times when working on the acceptOnEnter config setting
Despite the fixes above this still happens. The reason seems to be that uses a timeout. That gives the triggerOnCharacter command a chance to run (and clear the previous suggest model) such that accept doesn't work
the timeout and like breakage happened in
Oh, the missing ! Ugh, sorry about that. The was just a leftover. I made a change that enables me to simply remove it. :+1: can you see whether the now works?
works