Skip to content

Commit d575606

Browse files
committed
suggest collections with dots in them
1 parent 1382cfb commit d575606

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

packages/mongodb-ts-autocomplete/src/autocompleter.spec.ts

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ describe('MongoDBAutocompleter', function () {
8484
databasesForConnection: () =>
8585
Promise.resolve(['db1', 'db2', databaseName]),
8686
collectionsForDatabase: () =>
87-
Promise.resolve(['foo', 'bar', 'baz', collectionName]),
87+
Promise.resolve(['foo', 'bar', 'baz', collectionName, 'one.two']),
8888
schemaInformationForCollection: async (
8989
connectionId: string,
9090
databaseName: string,
@@ -217,6 +217,19 @@ describe('MongoDBAutocompleter', function () {
217217
}
218218
});
219219

220+
it('completes a collection name with a dot in it', async function () {
221+
for (let i = 0; i < 2; i++) {
222+
const completions = await autocompleter.autocomplete('db.on');
223+
expect(completions).to.deep.equal([
224+
{
225+
kind: 'property',
226+
name: 'one.two',
227+
result: 'db.one.two',
228+
},
229+
]);
230+
}
231+
});
232+
220233
it('completes a collection method', async function () {
221234
for (let i = 0; i < 2; i++) {
222235
const completions = await autocompleter.autocomplete('db.foo.fi');

packages/ts-autocomplete/src/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -255,6 +255,8 @@ export default class Autocompleter {
255255
code.length,
256256
{
257257
allowIncompleteCompletions: true,
258+
// https://github.com/microsoft/TypeScript/blob/833a8d492c728d606454865e8c0fee84842f9f10/tests/baselines/reference/api/typescript.d.ts#L8311-L8315
259+
includeCompletionsWithInsertText: true,
258260
},
259261
);
260262

0 commit comments

Comments
 (0)