5.1.0: `black` formatter duplicates part of the last line and breaks any code it formats
See original GitHub issueIssue Report Checklist
- Searched the issues page for similar reports
- Read the relevant sections of the Spyder Troubleshooting Guide and followed its advice
- Reproduced the issue after updating with
conda update spyder
(orpip
, if not using Anaconda) - Could not reproduce inside
jupyter qtconsole
(if console-related) - Tried basic troubleshooting (if a bug/error)
- Restarted Spyder
- Reset preferences with
spyder --reset
- Reinstalled the latest version of Anaconda
- Tried the other applicable steps from the Troubleshooting Guide
- Completed the Problem Description, Steps to Reproduce and Version sections below
Problem Description
When using black
as a formatter the last line of a file is duplicated when the formatter is run.
What steps reproduce the problem?
- Start Spyder 5.1.0
- In Tools -> Preferences -> Completion and linting -> Code style and formatting select
black
as the formatter - Run the formatter on a piece of code (Source -> Format file or selection with Black)
What is the expected output? What do you see instead?
Expected: The file is formatted with the black
formatter, no code is added.
Actual: The file is formatted, but part of the last line is duplicated on a new line at the end (see GIF below):
Paste Traceback/Error Below (if applicable)
N/A
Versions
- Spyder version: 5.1.0 None
- Python version: 3.7.9 64-bit
- Qt version: 5.12.10
- PyQt5 version: 5.12.3
- Operating System: Windows 10
Dependencies
# Mandatory:
atomicwrites >=1.2.0 : 1.4.0 (OK)
chardet >=2.0.0 : 4.0.0 (OK)
cloudpickle >=0.5.0 : 1.6.0 (OK)
cookiecutter >=1.6.0 : 1.7.3 (OK)
diff_match_patch >=20181111 : 20200713 (OK)
intervaltree : None (OK)
IPython >=7.6.0 : 7.26.0 (OK)
jedi >=0.17.2;<0.19.0 : 0.18.0 (OK)
jsonschema >=3.2.0 : 3.2.0 (OK)
keyring >=17.0.0 : 23.0.1 (OK)
nbconvert >=4.0 : 6.1.0 (OK)
numpydoc >=0.6.0 : 1.1.0 (OK)
paramiko >=2.4.0 : 2.7.2 (OK)
parso >=0.7.0;<0.9.0 : 0.8.2 (OK)
pexpect >=4.4.0 : 4.8.0 (OK)
pickleshare >=0.4 : 0.7.5 (OK)
psutil >=5.3 : 5.8.0 (OK)
pygments >=2.0 : 2.9.0 (OK)
pylint >=2.5.0 : 2.9.6 (OK)
pyls_spyder >=0.4.0 : 0.4.0 (OK)
pylsp >=1.2.0;<1.3.0 : 1.2.0 (OK)
pylsp_black >=1.0.0 : None (OK)
qdarkstyle =3.0.2 : 3.0.2 (OK)
qstylizer >=0.1.10 : 0.2.1 (OK)
qtawesome >=1.0.2 : 1.0.3 (OK)
qtconsole >=5.1.0 : 5.1.1 (OK)
qtpy >=1.5.0 : 1.9.0 (OK)
rtree >=0.9.7 : 0.9.7 (OK)
setuptools >=49.6.0 : 57.4.0 (OK)
sphinx >=0.6.6 : 4.1.2 (OK)
spyder_kernels >=2.1.0;<2.2.0 : 2.1.0 (OK)
textdistance >=4.2.0 : 4.2.1 (OK)
three_merge >=0.1.1 : 0.1.1 (OK)
watchdog : 2.1.3 (OK)
zmq >=17 : 22.1.0 (OK)
# Optional:
cython >=0.21 : 0.29.24 (OK)
matplotlib >=2.0.0 : 3.4.2 (OK)
numpy >=1.7 : 1.19.3 (OK)
pandas >=1.1.1 : 1.3.1 (OK)
scipy >=0.17.0 : 1.7.1 (OK)
sympy >=0.7.3 : 1.8 (OK)
# Spyder plugins:
spyder.plugins.completion.plugin 5.1.0 : 5.1.0 (OK)
spyder.plugins.outlineexplorer.plugin 5.1.0 : 5.1.0 (OK)
spyder.plugins.projects.plugin 5.1.0 : 5.1.0 (OK)
spyder.plugins.variableexplorer.plugin 5.1.0 : 5.1.0 (OK)
Issue Analytics
- State:
- Created 2 years ago
- Comments:9 (2 by maintainers)
Top Results From Across the Web
The Black code style - Black 22.12.0 documentation
Black standardizes most numeric literals to use lowercase letters for the syntactic parts and uppercase letters for the digits themselves: 0xAB instead of...
Read more >fputcsv - Manual - PHP
fputcsv() formats a line (passed as a fields array) as CSV and writes it (terminated by a newline) to the specified file stream...
Read more >black · PyPI
“Any color you like.” Black is the uncompromising Python code formatter. By using it, you agree to cede control over minutiae of hand-formatting....
Read more >Unreal Engine 5.1 Release Notes
The Light Mixer is a new editor window that displays all lights in the scene in a compact tabular format for rapid inspection...
Read more >Changelog - Cypress Documentation
Breaking Changes: Cypress dropped support for Node.js 12, 15 and 17. Those versions have reached end-of-life. Installing Cypress on your system now requires ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Ok, this is very strange because it seems
pylsp_black
was not included in our installer. I’ll take a look at it and try to fix it in 5.1.1, to be released as soon as I can.Hello. Sorry for my late response.
Yes, I tried to reset the settings. I also tried to reinstall Spyder and reinstall the miniconda with a fresh installation of Spyder too. None of these worked.