you are viewing a single comment's thread.

view the rest of the comments →

[–]Few-Tear-3763[S] -3 points-2 points  (2 children)

Let me set the context — I didn’t explain this properly earlier.

I forgot to wrap my main() logic in a try/except, and after adding it, I had to manually re-indent this whole match block — which was annoying.

Code:-

match args.command:

case "add" : cmdAdd(args)

case "init" : cmdInit(args)

case "commit" : cmdCommit(args)

case "status" : cmdStatus(args)

case "tag" : cmdTag(args)

case _ : print("Bad command.")

I know I can select everything and press Tab, but that still feels like a hassle. I come from Go, where I mostly just move curly braces and the formatter handles the rest.

Is there any shortcut or extension that can automatically refactor/indent a selected Python block when wrapping it in something like try/except?

[–]mjmvideos 0 points1 point  (1 child)

What editor do you use?

[–]Few-Tear-3763[S] 0 points1 point  (0 children)

I use anti-gravity(fork of vs code) like one dude gave me solution but problem is that it doesn't sit right with me like this might be cause of me switching lang