PY-25001 Implement Complete Current Statement for collection literals

It works by automatically inserting a trailing comma before a line break in
multiline collection literals. Additionally, a colon is inserted between a key
and a value in dict literals.

Because of the language ambiguity regarding syntax of some incomplete collection
literals, colon is not inserted after the first key of a dict literal
(it's indistinguishable from a set literal with one item), and comma is not
inserted after the first item of a parenthesized tuple (it's indistinguishable
from a parenthesized expression).

The idea was taken from such implementation of Complete Current Statement for
JSON.

GitOrigin-RevId: 49ff9857d8c12476bfa9aacaed0b49faa99810fd
This commit is contained in:
Mikhail Golubev
2020-06-10 22:57:53 +03:00
committed by intellij-monorepo-bot
parent 3ec7d70b0d
commit 16eebe034e
40 changed files with 342 additions and 1 deletions
@@ -0,0 +1,4 @@
d = {
'key1': 1,
'key2'<caret>
}