-
Notifications
You must be signed in to change notification settings - Fork 34k
Description
A common issue users have brought up when using whole line completions is that if the completion has open brackets, they are not auto-closed when the user accepts the completion. Users depend upon VS Code's bracket autoclosing and when they don't experience the same when using whole line completions, it deteriorates their user experience.
To allow us to show whole line completions and reliably have balanced brackets, we'd like the ability to interact with the bracket auto-closing API which we can use to close open brackets inserted in a whole line completion.
This is how we achieve the same in Visual Studio:
-
We provide a whole line completion containing an open parenthesis in the end
-
When the user accepts the completion, we start a brace completion session for the open parenthesis. The open paren is then closed by the language service and the cursor is placed in between the open and close paren.
If the user opens a brace inside quotation, it doesn't start a brace completion session and hence, is not auto-closed.
Based on our experience with implementing this in Visual Studio, we'd need the below functionality in the API:
- Be able to look at the stack of bracket completion sessions; this will allow us to remove any unbalanced parenthesis introduced by whole line completions.
- Be able to simulate the user typing characters so that a brace completion session can be started which will tell language service to return the closing brace
(cc @hediet)