This repository has been archived by the owner on Apr 14, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 131
Implement on-type block formatting #165
Comments
DonJayamanne
pushed a commit
to microsoft/vscode-python
that referenced
this issue
Oct 9, 2018
For #2690. Similar to #2612. Note that `:`-based formatting isn't implemented in language server yet (microsoft/python-language-server#165), but it hasn't been enabled in the extension for anyone for a while now either (fixed in #2714/#2724). Since line formatting is relatively new in language server, this likely shouldn't make it out into a release until the language server downloaded by default is new enough to include that functionality. I haven't been monitoring that side of things, so feel free to hold off on merging this until the right time.
jakebailey
pushed a commit
to jakebailey/python-language-server
that referenced
this issue
Nov 1, 2019
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
The VS Code extension provides an on-type formatter that triggers on
:
which allows for block formatting. For example, you can hit colon after theelse
in the following code:Which will then be reformatted into:
This functionality should be implemented in language server for feature parity. The language server may even be able to handle more cases correctly than the extension's use of regex, since we have access to an AST.
Since on-type formatting has only one entrypoint (
DocumentOnTypeFormatting
), that function would need to map trigger characters to the right handler. A nicety would be to have a Dictionary of handlers, then produce theDocumentOnTypeFormattingOptions
's trigger character members from that dictionary rather than needing to remember to change the characters in two different files.Related to microsoft/vscode-python#2714.
The text was updated successfully, but these errors were encountered: