Eclipse pydev:运行程序时自动保存文件
过去,当我在 Eclipse 中对 .py 文件进行更改时,当我在调试模式下运行程序时,更改会自动保存。我喜欢这个,因为这意味着它正在调试的内容与我正在查看的内容相同。现在它不再这样做,这意味着它实际上运行的是旧版本,除非我先手动保存文件。我第一次运行该程序时,Eclipse 问我是否始终希望在程序运行时保存任何更改,我回答是。我不知道为什么它不再这样做或者如何恢复它。
这似乎是在我开始使用 Mercurial TortoiseHg 和 BitBucket 后发生的。作为其中的一部分,我确实移动了一些文件,但一切都回来了,并且命名与以前相同。
当然,我可以只进行更改、保存、运行,但我宁愿不必记住额外的保存步骤。
编辑:实际上这是一个更大的问题。它还改变了我的断点。在常规编辑模式下,我1)设置断点并保存。 2) 在断点上方添加新行。一切看起来都很好。 3)保存。现在第一个断点改变了位置。
It used to be that when I made changes to my .py file in Eclipse, then the changes would be automatically saved when I then ran the program in debug mode. I liked this since it meant that what it was debugging was the same as what I was looking at. Now it no longer does that, which means that's it's actually running an old version, unless I manually save the file first. The first time I ran the program, Eclipse asked me whether I always wanted any changes to be saved when the program was run, and I answered yes. I don't know why it doesn't do it anymore or how to get it back.
This seems to have happened after I started using Mercurial TortoiseHg with BitBucket. As part of that, I did move some files around, but everything is back and named the same as before.
Of course, I can just do change, save, run, but I'd rather not have to remember the extra save step.
Edit: Actually it's a bigger problem. It also shifts my breakpoints. In regular edit mode, I 1) set a break point and Save. 2) Add a new line above the breakpoint. Everything looks fine. 3) Save. Now the first breakpoint shifts position.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
从您的描述来看,您似乎总是将文件作为外部文件而不是工作区中的文件打开(断点未更新的事实是这里的主要线索)。
您可以从 Eclipse 中显示的标题检查这是否是发生的情况(如果它是完整的文件系统路径,而不是考虑到您的工作空间位置的相对路径,则这可能是发生的情况)。
您如何打开正在运行的文件?您是从 PyDev 包资源管理器打开它还是从文件系统拖动? (另外,知道您使用的是哪个 eclipse/pydev/tortoise 版本会很有趣)
From your description, it seems that you're always opening the file as an external file and not a file within your workspace (the fact that breakpoints don't get updated is the major clue here).
You can check if this is what happening from the title that's shown in Eclipse (if it's a full filesystem path and not relative path considering your workspace location, this is what's probably happening).
How are you opening the file you're running? Are you opening it from the PyDev package explorer or dragging from the filesystem? (also, it'd be interesting knowing which eclipse/pydev/tortoise versions are you using)
查看您的首选项 ->运行/调试->启动时,您可能在启动之前将“保存所需的脏编辑器”设置为“从不”。
Look at your Preferences -> Run/Debug -> Launching, you probably have "Never" set for Save Required Dirty Editors before launching.