question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Format on save with black isn't working

See original GitHub issue

When saving a file, [coc.nvim] Formatted with black is printed, but the file isn’t changed. Running call CocAction('format') also prints the message, but the file is then updated. The output from :CocCommand workspace.showOutput is as follows:

########## active formattor: black
execPath:   black
moduleName: black
args:       --diff,--quiet,/home/devneal/github/manim/manim/mobject/mobject.py.2c210016803c1db7200eb6ec681835ba.py

########## black output:
--- /home/devneal/github/manim/manim/mobject/mobject.py.2c210016803c1db7200eb6ec681835ba.py	2020-12-30 05:10:36.386043 +0000
+++ /home/devneal/github/manim/manim/mobject/mobject.py.2c210016803c1db7200eb6ec681835ba.py	2020-12-30 05:10:37.032054 +0000
@@ -1317,8 +1317,10 @@
 
         self.method = getattr(self.mobject.generate_target(), method_name)
 
         def build(*method_args, **method_kwargs):
             self.method(*method_args, **method_kwargs)
-            return _MethodAnimation(self.mobject, self.method, method_args,                method_kwargs)
+            return _MethodAnimation(
+                self.mobject, self.method, method_args, method_kwargs
+            )
 
         return build

It seems like a temp file may be being formatted instead of the actual file, but I don’t know if this is expected.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:36 (17 by maintainers)

github_iconTop GitHub Comments

5reactions
fannheywardcommented, Mar 10, 2021

The latest coc has added coc.preferences.willSaveHandlerTimeout, you can increase this time limitation.

4reactions
swizzardcommented, Jan 4, 2021
aug python
  au!
  au BufWrite *.py call CocAction('format')
aug END

in my .nvimrc file worked for me

Read more comments on GitHub >

github_iconTop Results From Across the Web

Formatter black is not working on my VSCode...but why?
I use Black from inside VSCode and it rocks. It frees mental cycles that you would spend deciding how to format your code....
Read more >
Black formatting is not applied (but black runs) #18561 - GitHub
Issue Type: Bug Behaviour When formatting a *.py file with black, no changes are applied. I can see in the log black being...
Read more >
Setting up python Black on Visual Studio Code | by Marco Belo
Type “format on save” at the search bar on top of the Settings tab and check the box. Search for “python formatting provider”...
Read more >
Black 22.12.0 documentation
Black makes code review faster by producing the smallest diffs possible. Blackened code looks the same regardless of the project you're reading. Formatting...
Read more >
Differences between the OpenDocument Spreadsheet (.ods ...
Area Subarea Level of Support Excel for Microsoft 365 and Excel 2021 Formatting Row Heights/Column widths Supported. Appearance should be similar. Formatting Cell Supported
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found