Repository navigation
Autoformat with black - #11734
Autoformat with black#11734
Conversation
LucianaMarques
left a comment
There was a problem hiding this comment.
I'm not getting where you are checking whether black is installed, could you please point it out for me? :) Thanks!
|
|
||
| def newline_or_execute_outer(shell): | ||
|
|
||
| import black |
There was a problem hiding this comment.
Just out of curiosity, why is this here and not above with all the other modules being imported?
| """When the user presses return, insert a newline or execute the code.""" | ||
| b = event.current_buffer | ||
| d = b.document | ||
| def try_reformat(): |
There was a problem hiding this comment.
I think it's a little bit confusing to define a function inside of another function. Could you please tell me whether there's a specific reason for this?
There was a problem hiding this comment.
For both of your questions the answer is : "there is no reason beyond pure lazyness", I was prototyping and looking at "can this be done"; you are right that a proper implementation should move the import to the top of the file and define the try_reformat() function outside, passing in the b buffer.
There was a problem hiding this comment.
Ok, fair enough :)
How do you check whether black is activated?
|
I've pushed some update, including some documentation; and will try to get that in a a preview for 7.10 at end of month. |


Prototype,
see https://twitter.com/Mbussonn/status/1128841958711889920