You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Apr 14, 2022. It is now read-only.
The VS Code extension provides an on-type formatter that triggers on : which allows for block formatting. For example, you can hit colon after the else in the following code:
ifx:
passelse
Which will then be reformatted into:
ifx:
passelse:
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 the DocumentOnTypeFormattingOptions's trigger character members from that dictionary rather than needing to remember to change the characters in two different files.
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.
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: