如何关闭某些 .py 文件的 Pydev 缩进警告
我的项目中有一些来自外部源的文件,我从不编辑这些文件,但有时会逐步执行。这些文件使用与我的默认缩进样式不同的缩进样式(2 个空格与 4 个空格),并且我目前对它们发出了许多缩进警告。是否有一种简单的方法可以逐个文件地抑制这些警告(或者指定缩进样式)?我希望能够用相当于在文件顶部添加的 pragma 行来解决我的问题,但到目前为止我还没有找到这样的东西。 (顺便说一句,我不想完全关闭缩进警告,因为我发现它们在编辑代码时很有用。)
I have some files in my project that are from an external source and that I never edit but sometimes step through. These files use a different indentation style from my default one (2 spaces vs. 4 spaces), and I currently many indentation warnings on them. Is there an easy way to suppress these warnings (or alternatively, specify an indentation style) on a file by file basis? I would expect to be able to solve my problem with the equivalent of a pragma line that I add at the top of the file but so far I haven't found such a thing. (BTW I would rather not turn off indentation warnings altogether, as I find them useful when editing code.)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以将 #@PydevCodeAnalysisIgnore 添加到文件的开头,以使 PyDev 跳过该文件的代码分析 - 包括缩进警告(即:转到文件顶部并执行 Ctrl+1,这样的选项将是向您展示)。
You can add #@PydevCodeAnalysisIgnore to the beginning of your file to have PyDev skip its code-analysis of that file -- including the indentation warnings (i.e.: go to the top of your file and do Ctrl+1 and such an option will be shown to you).