Skip to content
This repository was archived by the owner on Apr 14, 2022. It is now read-only.
This repository was archived by the owner on Apr 14, 2022. It is now read-only.

Feature request: Auto-convert .format() to f-string #1271

@WSLUser

Description

@WSLUser

Environment data

  • VS Code version: 1.35 (Insiders)
  • Extension version (available under the Extensions sidebar): Version: 2019.4.12954
    Publisher: Microsoft
  • OS and version: N/A
  • Python version (& distribution if applicable, e.g. Anaconda): 3.7.3
  • Type of virtual environment used (N/A | venv | virtualenv | conda | ...): N/A
  • Relevant/affected Python packages and their versions: 3.6+

Expected behaviour

I highlight a print statement that uses .format and get an option to convert to f-string using the UI menu or through a shortcut.

Actual behaviour

Per this blog Pycharm supports f-strings. From the blog: "Python programs that still use the .format() method, you can just press Alt+Enter and select that intention to convert everything to the new syntax."

I want to see the same feature in VSCode with possibly a different shortcut.

Steps to reproduce:

  1. Highlight a print statement with a .format() in it. See only the usual options available from the menu e.g. "Format Document", etc.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions