Problem
ShellCompletionProvider.detectMethodArgContext() determines whether the cursor is inside a collection method call by scanning backward and counting raw ( / ) characters. The scanner does not ignore parentheses that appear inside quoted strings or regex literals.
That can make the provider miss the real method-call boundary and suppress completions while the user is still editing a valid query object.
Repro examples
db.users.find({ note: ")", na| })
db.users.find({ name: /foo(bar)/, ag| })
At the cursor, field-name completions should still be available for the find() filter object.
Expected behavior
Parentheses inside string literals, regex literals, and comments should not affect method-argument context detection.
Current behavior
A literal ) inside input such as ")" or /foo(bar)/ can change the depth calculation and cause completions to disappear.
Notes
This is called out in docs/ai-and-plans/shell-autocompletion/9-shell-autocompletion-review.md under review item #21.
Problem
ShellCompletionProvider.detectMethodArgContext()determines whether the cursor is inside a collection method call by scanning backward and counting raw(/)characters. The scanner does not ignore parentheses that appear inside quoted strings or regex literals.That can make the provider miss the real method-call boundary and suppress completions while the user is still editing a valid query object.
Repro examples
At the cursor, field-name completions should still be available for the
find()filter object.Expected behavior
Parentheses inside string literals, regex literals, and comments should not affect method-argument context detection.
Current behavior
A literal
)inside input such as")"or/foo(bar)/can change the depth calculation and cause completions to disappear.Notes
This is called out in
docs/ai-and-plans/shell-autocompletion/9-shell-autocompletion-review.mdunder review item#21.