-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enhanced f-string completion #13203
Comments
Thank you for the suggestion! We have marked this issue as "needs decision" to make sure we have a conversation about your idea. We plan to leave this feature request open for at least a month to see how many 👍 votes the opening comment gets to help us make our decision. |
@jakebailey is this something that could be addressed by Pylance? |
I'm not sure that this sort of thing is possible in LSP (or even VS Code). We can only edit the document by responding with a text change, e.g. we give a text change in a completion response, or give a text change for a quick fix, etc. The LSP is designed such that the client accepts changes the server suggests. We could technically detect that these characters were typed (it's gross to try), but then to get the changes back, you'd have to hack something together to force the changes in the client; I'm not familiar enough with the VS Code API to know if that's possible or a good UX. I can't say I've ever seen text edits provided by anything but completions, quickfixes, formatting, etc. I have other UX issues with this feature, in any case; I'd think this would be annoying to anyone typing regular format strings where they just want |
This is now possible when using Pylance: https://devblogs.microsoft.com/python/python-in-visual-studio-code-may-2023-release/#automatic-conversion-of-f-strings-with-pylance You just need to enable |
Pycharm just released a new version with a feature that would be great to have in vscode. It will turn a string into an
f-string
if you add a pair of curly braces inside of it.https://www.jetbrains.com/pycharm/whatsnew/
The text was updated successfully, but these errors were encountered: