This is probably a simple issue but something is wrong with my Python tools for visual studio. When I first started using VS2015 for Python it would auto-indent whenever I used a colon. Now VS2015 is just acting like a text editor with syntax highlighting. I tried uninstalling and reinstalling the Python tools but that did not work. How do I fix Visual Studio to auto-style as I write Python again?
Go to "Command Palette" Ctrl + Shift + P (View>Command Palette) Type in & select "Convert Indentation to Tabs" and press Enter.
Auto formatting settings in Visual Studio Show activity on this post. Select the text you want to automatically indent. Click menu Edit → Advanced → *Format Selection, or press Ctrl + K , Ctrl + F . Format Selection applies the smart indenting rules for the language in which you are programming to the selected text.
Use the reindent.py script that you find in the Tools/scripts/ directory of your Python installation: Change Python (. py) files to use 4-space indents and no hard tab characters. Also trim excess spaces and tabs from ends of lines, and remove empty lines at the end of files.
Press Ctrl+Shift+P to open Command Palette. Type in settings and select Open User Settings. In Search settings box, input indent to search for settings related to indentation. Select full in Editor: Auto Indent section.
Tools -> Options -> Text editor -> Python -> Tabs
and set it to Smart
http://stevedower.id.au/blog/smart-indentation-for-python/
However, the most common (and default) mode is “Smart.” Unlike the other two modes, which are built into the editor, smart indentation is provided by a language service (which are also responsible for providing syntax highlighting and completions). Because they are targeted to a specific language, they can help the programmer by automatically adding and removing extra indentation in ways that make sense.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With