"Format document" doesn't do anything
See original GitHub issueEnvironment data
- VS Code version: version 1.32.3
- Extension version (available under the Extensions sidebar): 2019.2.5558
- OS and version: Windows 10, version 1809, OS Build 17763.379
- Python version (& distribution if applicable, e.g. Anaconda): 3.6.4 64-bit
- Type of virtual environment used (N/A | venv | virtualenv | conda | …): N/A i think, not 100% sure
Expected behaviour
Format my python document
Actual behaviour
I can’t see it doing anything but running and quitting
Steps to reproduce:
- make a python file
- write code on it
- try to format it 4.??? 5.nothing happens
Logs
Output for Python
in the Output
panel
Starting Microsoft Python language server.
##########Linting Output - flake8##########
8,3,E,E303:too many blank lines (2)
8,3,E,E114:indentation is not a multiple of four (comment)
8,3,E,E116:unexpected indentation (comment)
15,3,E,E114:indentation is not a multiple of four (comment)
16,1,W,W293:blank line contains whitespace
17,3,E,E114:indentation is not a multiple of four (comment)
18,1,E,E302:expected 2 blank lines, found 1
29,3,E,E114:indentation is not a multiple of four (comment)
30,3,E,E114:indentation is not a multiple of four (comment)
31,1,E,E305:expected 2 blank lines after class or function definition, found 0
33,13,W,W291:trailing whitespace
33,13,E,E999:SyntaxError: invalid syntax
Microsoft Python Language Server version 0.1.80.0
Initializing for C:\Python36\python.exe
Output from Console
under the Developer Tools
panel
console.ts:134 [Extension Host] Python Extension: Current value for rule windowsRegistry is {"architecture":3,"path":"C:\\Users\\Desktop-Z\\AppData\\Local\\Programs\\Python\\Python36\\python.exe","version":{"raw":"3.6.5-final","major":3,"minor":6,"patch":5,"prerelease":["final"],"build":[],"version":"3.6.5-final"},"sysPrefix":"C:\\Users\\Desktop-Z\\AppData\\Local\\Programs\\Python\\Python36","fileHash":"01fffab9af52f250db5afb2fb6d879e9dae37dd69f00cd9c256aa83ddacac6aa753009fbdf06448b6bcaba9fe9a2f5e6a29913028d25bef2c4a67003fe031c62","companyDisplayName":"Python Software Foundation","type":"Unknown"}
console.ts:134 [Extension Host] Python Extension: Selected Interpreter from cachedInterpreters, {"architecture":3,"path":"C:\\Users\\Desktop-Z\\AppData\\Local\\Programs\\Python\\Python36\\python.exe","version":{"raw":"3.6.5-final","major":3,"minor":6,"patch":5,"prerelease":["final"],"build":[],"version":"3.6.5-final"},"sysPrefix":"C:\\Users\\Desktop-Z\\AppData\\Local\\Programs\\Python\\Python36","fileHash":"01fffab9af52f250db5afb2fb6d879e9dae37dd69f00cd9c256aa83ddacac6aa753009fbdf06448b6bcaba9fe9a2f5e6a29913028d25bef2c4a67003fe031c62","companyDisplayName":"Python Software Foundation","type":"Unknown"}
console.ts:134 [Extension Host] Python Extension: Selected Interpreter from system, {"architecture":3,"path":"C:\\Users\\Desktop-Z\\AppData\\Local\\Programs\\Python\\Python36\\python.exe","version":{"raw":"3.6.5-final","major":3,"minor":6,"patch":5,"prerelease":["final"],"build":[],"version":"3.6.5-final"},"sysPrefix":"C:\\Users\\Desktop-Z\\AppData\\Local\\Programs\\Python\\Python36","fileHash":"01fffab9af52f250db5afb2fb6d879e9dae37dd69f00cd9c256aa83ddacac6aa753009fbdf06448b6bcaba9fe9a2f5e6a29913028d25bef2c4a67003fe031c62","companyDisplayName":"Python Software Foundation","type":"Unknown","displayName":"Python 3.6.5 64-bit"}
console.ts:134 [Extension Host] Python Extension: Current value for rule workspaceEnvs is nothing
console.ts:134 [Extension Host] Python Extension: setGlobalInterpreter, Class name = g, Arg 1: {"architecture":3,"path":"C:\\Users\\Desktop-Z\\AppData\\Local\\Programs\\Python\\Python36\\python.exe","version":{"raw":"3.6.5-final","major":3,"minor":6,"patch":5,"prerelease":["final"],"build":[],"version":"3.6.5-final"},"sysPrefix":"C:\\Users\\Desktop-Z\\AppData\\Local\\Programs\\Python\\Python36","fileHash":"01fffab9af52f250db5afb2fb6d879e9dae37dd69f00cd9c256aa83ddacac6aa753009fbdf06448b6bcaba9fe9a2f5e6a29913028d25bef2c4a67003fe031c62","companyDisplayName":"Python Software Foundation","type":"Unknown"}, Arg 2: undefined, Return Value: false
console.ts:134 [Extension Host] Python Extension: setGlobalInterpreter, Class name = g, Arg 1: {"architecture":3,"path":"C:\\Users\\Desktop-Z\\AppData\\Local\\Programs\\Python\\Python36\\python.exe","version":{"raw":"3.6.5-final","major":3,"minor":6,"patch":5,"prerelease":["final"],"build":[],"version":"3.6.5-final"},"sysPrefix":"C:\\Users\\Desktop-Z\\AppData\\Local\\Programs\\Python\\Python36","fileHash":"01fffab9af52f250db5afb2fb6d879e9dae37dd69f00cd9c256aa83ddacac6aa753009fbdf06448b6bcaba9fe9a2f5e6a29913028d25bef2c4a67003fe031c62","type":"Unknown"}, Arg 2: undefined, Return Value: false
console.ts:134 [Extension Host] Python Extension: setGlobalInterpreter, Class name = g, Arg 1: {"architecture":3,"path":"C:\\Users\\Desktop-Z\\AppData\\Local\\Programs\\Python\\Python36\\python.exe","version":{"raw":"3.6.5-final","major":3,"minor":6,"patch":5,"prerelease":["final"],"build":[],"version":"3.6.5-final"},"sysPrefix":"C:\\Users\\Desktop-Z\\AppData\\Local\\Programs\\Python\\Python36","fileHash":"01fffab9af52f250db5afb2fb6d879e9dae37dd69f00cd9c256aa83ddacac6aa753009fbdf06448b6bcaba9fe9a2f5e6a29913028d25bef2c4a67003fe031c62","companyDisplayName":"Python Software Foundation","type":"Unknown"}, Arg 2: undefined, Return Value: false
console.ts:134 [Extension Host] Python Extension: Rule = windowsRegistry, result = runNextRule
console.ts:134 [Extension Host] Python Extension: Executing next rule from windowsRegistry
console.ts:134 [Extension Host] Python Extension: Rule = currentPath, result = runNextRule
console.ts:134 [Extension Host] Python Extension: Executing next rule from currentPath
console.ts:134 [Extension Host] Python Extension: Rule = cachedInterpreters, result = runNextRule
console.ts:134 [Extension Host] Python Extension: Executing next rule from cachedInterpreters
3
console.ts:134 [Extension Host] Python Extension: autoSelectInterpreter, Class name = g, Arg 1: undefined, Return Value: undefined
console.ts:134 [Extension Host] Python Extension: Interpreters returned by PipEnvService are of count 0
console.ts:134 [Extension Host] Python Extension: Interpreters returned by WorkspaceVirtualEnvService are of count 0
console.ts:134 [Extension Host] Python Extension: setGlobalInterpreter, Class name = g, Arg 1: {"architecture":3,"path":"C:\\Users\\Desktop-Z\\AppData\\Local\\Programs\\Python\\Python36\\python.exe","version":{"raw":"3.6.5-final","major":3,"minor":6,"patch":5,"prerelease":["final"],"build":[],"version":"3.6.5-final"},"sysPrefix":"C:\\Users\\Desktop-Z\\AppData\\Local\\Programs\\Python\\Python36","fileHash":"01fffab9af52f250db5afb2fb6d879e9dae37dd69f00cd9c256aa83ddacac6aa753009fbdf06448b6bcaba9fe9a2f5e6a29913028d25bef2c4a67003fe031c62","companyDisplayName":"Python Software Foundation","type":"Unknown","displayName":"Python 3.6.5 64-bit"}, Arg 2: undefined, Return Value: false
console.ts:134 [Extension Host] Python Extension: Rule = system, result = runNextRule
console.ts:134 [Extension Host] Python Extension: Executing next rule from system
console.ts:134 [Extension Host] Python Extension: Checking whether locactors have completed locating, Class name = p, , Return Value: true
console.ts:134 [Extension Host] Python Extension: Hide locator refreshing progress, Class name = p, , Return Value: undefined
console.ts:134 [Extension Host] Python Extension: All locators have completed locating, Class name = p, , Return Value: undefined
console.ts:134 [Extension Host] Python Extension: autoSelectInterpreter, Class name = g, Arg 1: undefined, Return Value: undefined
dom.ts:213 [Violation] Added non-passive event listener to a scroll-blocking 'mousewheel' event. Consider marking event handler as 'passive' to make the page more responsive. See https://www.chromestatus.com/feature/5745543795965952
dom.ts:213 [Violation] Added non-passive event listener to a scroll-blocking 'mousewheel' event. Consider marking event handler as 'passive' to make the page more responsive. See https://www.chromestatus.com/feature/5745543795965952
dom.ts:213 [Violation] Added non-passive event listener to a scroll-blocking 'mousewheel' event. Consider marking event handler as 'passive' to make the page more responsive. See https://www.chromestatus.com/feature/5745543795965952
console.ts:134 [Extension Host] Python Extension: Cached data exists getEnvironmentVariables, extension-output-#6
dom.ts:213 [Violation] Added non-passive event listener to a scroll-blocking 'mousewheel' event. Consider marking event handler as 'passive' to make the page more responsive. See https://www.chromestatus.com/feature/5745543795965952
console.ts:134 [Extension Host] Python Extension: Cached data exists getEnvironmentVariables, c:\Users\Desktop-Z\Documents\vscode\Github
8
dom.ts:213 [Violation] Added non-passive event listener to a scroll-blocking 'mousewheel' event. Consider marking event handler as 'passive' to make the page more responsive. See https://www.chromestatus.com/feature/5745543795965952
console.ts:134 [Extension Host] Python Extension: Cached data exists getEnvironmentVariables, c:\Users\Desktop-Z\Documents\vscode\Github\V3n0M-Scanner\v3n0m\v3n0m2.py
dom.ts:213 [Violation] Added non-passive event listener to a scroll-blocking 'mousewheel' event. Consider marking event handler as 'passive' to make the page more responsive. See https://www.chromestatus.com/feature/5745543795965952
console.ts:134 [Extension Host] Python Extension: Cached data exists getEnvironmentVariables, c:\Users\Desktop-Z\Documents\vscode\Github\V3n0M-Scanner\v3n0m\v3n0m2.py
Issue Analytics
- State:
- Created 5 years ago
- Reactions:7
- Comments:16
Top Results From Across the Web
Format document doesn't work - Visual Studio Feedback
If I create a brand new netcoreapp2.0 app then formatting works as expected. However formatting c# code of a brand new netcoreapp1.1 app...
Read more >"Prettier - Code formatter" is not working in Visual Studio code
as @harkesh kumar said : press Ctrl+shift+p and type format document then select prettier format, it may work for you.
Read more >Word document formatting is not retained when document is ...
To work around this issue, insert your source document as a subdocument in a master ... Method 1: If the source document does...
Read more >VS Code - You don't need a formatting extension (Prettier and ...
"vscode.typescript-language-features" does not work for javascript file!? Thanks in advance!
Read more >Will Word change my formatting if I send it to someone else?
What happens when Word opens a document? When Word opens a document, it doesn't care about the styles in the template on which...
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
I bumped into this problem again.
This time it was not caused by problems in the file parsin, and instead, it was caused incorrect usage of “python.formatting.blackArgs” in the settings.json file. The correct way of having “python.formatting.blackArgs” in settings.json is as follows:
"python.formatting.blackArgs": ["--arg1", "arg1input", "--arg2"]
for example:"python.formatting.blackArgs": ["--line-length", "100", "--fast"]
I thought to add this here, for people to find when they face problems with black formatting on vscode.
I have a related issue, if i run yapf from the console it goes ok but if the first line of the python file to format is empty it raises:
python v3.7.3 VSCode v1.43.1 YAPF v0.29.0 Empty 1st line Not empty 1st line