Visual Studio,Python不自动缩进

2024-05-20 15:01:40 发布

您现在位置:Python中文网/ 问答频道 /正文

这可能是一个简单的问题,但我的visual studio Python工具有问题。当我第一次开始为Python使用VS2015时,每当我使用冒号时,它就会自动缩进。现在VS2015就像一个语法突出显示的文本编辑器。我试着卸载并重新安装Python工具,但是没有成功。当我再次编写Python时,如何将Visual Studio修复为自动样式?


Tags: 工具语法样式文本编辑studiovisual冒号vs2015
3条回答

在Visual Studio中试试这个

Tools -> Option -> Text Editor -> Python -> Tabs
  • 禁用“保留标签”
  • 选择“插入空格”
  • 选择“缩进”作为“智能”

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.

Tools -> Options -> Text editor -> Python -> Tabs并将其设置为Smart

相关问题 更多 >