Enable matching curly braces inside of quotation marks in an f-string
See original GitHub issueTypically VS Code supplies a matching pair of parentheses, braces, and brackets when you type an opening character. But when you are inside of quotation marks, VS Code apparently gives up on this behavior, assuming that you are writing free text and not code. So you don’t get a closing brace automatically; you have to type it yourself. This is sub-optimal in Python when writing f-strings. In Python, you will often need to write matching braces inside of quotation marks, like so:
print(f"Let's talk about {some_variable}.")
When you type the opening brace inside the quotation marks, VS Code does not supply the closing brace—again, because VS Code apparently assumes you aren’t writing code. I would like VS Code to be able to detect when we are inside an f-string and, if we are, to automatically supply matching braces.
Issue Analytics
- State:
- Created 3 years ago
- Reactions:18
- Comments:11 (2 by maintainers)
Top GitHub Comments
I think I might have found a workaround for this. Change the Auto Closing Brackets setting to always.
If you don’t want this setting to mess up the configuration you have for your other languages, you can set it up to only be effective when working with Python files: