File tree Expand file tree Collapse file tree 3 files changed +16
-2
lines changed
Expand file tree Collapse file tree 3 files changed +16
-2
lines changed Original file line number Diff line number Diff line change @@ -497,6 +497,11 @@ describe('completer.completer', function () {
497497 } ) ;
498498
499499 context ( 'when context is aggregation query' , function ( ) {
500+ it ( 'returns all suggestions' , async function ( ) {
501+ const i = 'db.shipwrecks.aggregate([{' ;
502+ expect ( ( await completer ( standalone440 , i ) ) [ 0 ] ) . to . be . an ( 'array' ) ;
503+ } ) ;
504+
500505 it ( 'has several matches' , async function ( ) {
501506 const i = 'db.shipwrecks.aggregate([ { $so' ;
502507 expect ( await completer ( standalone440 , i ) ) . to . deep . equal ( [
Original file line number Diff line number Diff line change @@ -290,6 +290,12 @@ export async function completer(
290290 return [ [ ] , line ] ;
291291}
292292
293+ // from https://github.com/mongodb-js/devtools-shared/commit/e4a5b00a83b19a76bdf380799a421511230168db
294+ function satisfiesVersion ( v1 : string , v2 : string ) : boolean {
295+ const isGTECheck = / ^ \d + ?\. \d + ?\. \d + ?$ / . test ( v2 ) ;
296+ return semver . satisfies ( v1 , isGTECheck ? `>=${ v2 } ` : v2 ) ;
297+ }
298+
293299function isAcceptable (
294300 params : AutocompleteParameters ,
295301 entry : {
@@ -310,7 +316,10 @@ function isAcceptable(
310316 ! entry [ versionKey ] ||
311317 // TODO: when https://jira.mongodb.org/browse/SPM-2327 is done we can rely on server_version being present
312318 ! connectionInfo ?. server_version ||
313- semver . gte ( connectionInfo . server_version , entry [ versionKey ] as string ) ;
319+ satisfiesVersion (
320+ connectionInfo . server_version ,
321+ entry [ versionKey ] as string
322+ ) ;
314323 }
315324 const isAcceptableEnvironment =
316325 ! entry . env ||
Original file line number Diff line number Diff line change @@ -73,7 +73,7 @@ async function waitEval(bus: MongoshBus) {
7373async function waitCompletion ( bus : MongoshBus ) {
7474 await Promise . race ( [
7575 waitBus ( bus , 'mongosh:autocompletion-complete' ) ,
76- new Promise ( ( resolve ) => setTimeout ( resolve , 5000 ) ?. unref ?.( ) ) ,
76+ new Promise ( ( resolve ) => setTimeout ( resolve , 10_000 ) ?. unref ?.( ) ) ,
7777 ] ) ;
7878 await tick ( ) ;
7979}
You can’t perform that action at this time.
0 commit comments