问题描述:

What caches old files in sublime projects? Whenever I overwrite my code's directory (which includes project files) over an older version of the code's directory on my laptop, sublime still shows old code in files that have been deleted from the project on the laptop.

I'm about to make the initial commit on the project as well so should the project/workspace NOT be checked into git and be stored outside of the code's directory? I'm just scared of losing code or introducing old files/code back into the codebase because of this.

网友答案:

You can try setting hot_exit to false in your user preferences. The description for hot exit is as follows

// Exiting the application with hot_exit enabled will cause it to close
// immediately without prompting. Unsaved modifications and open files will
// be preserved and restored when next starting.
//
// Closing a window with an associated project will also close the window
// without prompting, preserving unsaved changes in the workspace file
// alongside the project.

That aside, I believe ST saves the content of the files in the .sublime-workspace file. If you always work from that project (across machines) you could technically check in your project file. Though you will have to do some additional work. ST creates projects using an absolute path, which isn't really helpful to check in in general as the file system may look different on different machines. I personally keep all my projects in a separate folder, and just create a new one on each machine. Up to you though.

网友答案:

Just close old files which were deleted (also select "no" on saving prompt). Sublime Text updates content only for those opened files which are exist. If not (they was deleted), it shows old content of these files from its own cache and give you chance to save them. I can't see any option which changes this behavior (Sublime Text 3 build 3047). It will show all files opened in the last session even some of them were deleted.

相关阅读:
Top