Using f-string in Python 3.6


When I use the new f-string feature for Python 3.6, the Atom (v 1.29.0) autocomplete feature doesn’t put in the 2nd " character after typing in f"Hello… When I type ." to end the f-string the autocomplete feature kicks in creating an extraneous " character. This ends up requiring me to delete the 2nd one manually. Is there a way to set up closing quote autocomplete with f-strings?


That’s not autocomplete-plus that’s doing it. It’s the package bracket-matcher. And you’ll notice that the behavior is consistent: when you add an end-bracket character, such as ', ", ), or ] to the end of a letter or number character (such as with f"), the package supposes that you might be completing a quote or using notation to indicate conjunctions (isn't) or measurements (5'6"). When you add an opening bracket to the start of a word or number, you see the same restraint.

The easiest way to get where you want to go would be to add a snippet to your snippets.cson file:

    prefix: 'f"'
    body: 'f"$1"'

With that in place, you can type f" and tab to both add the second quote and place the cursor inside the quotes.