Sublime Forum

Sublime Text recursively opening all files on save

#1

I’m evaluating Sublime Text as an alternative to VS Code and I started by setting up a project and opening a directory in Sublime Text. I noticed that once I hit ctrl+S in a file my laptop’s fan starts going at full blast, and I noticed four instances of sublime_text.exe hogging my cores. Iran Process Monitor and limited it to sublime_text.exe and then I saw that Sublime Text is recursively going over every file inside the project’s directory and doing a bunch of CreateFile(), ReadFile(), and QueryBasicInformationFile() calls.

Is this by design? My project consists of many files in many directories, and it takes minutes before Sublime Text is done going over all of them. How can I prevent this behavior?

0 Likes

#2

When opening a directory Sublime Text will index the files in that directory. This is to support features like Goto Definition. This indexing is done when you open the directory (not when you save a file) and is incrementally updated, so any future changes are much faster. If you don’t want to use this feature it can be disabled using the setting "index_files": false.

0 Likes

#3

But that’s not what I said ; let me help you a bit.
I left Sublime Text idle for over an hour and ProcMon showed mostly no noise. In my .sublime-project file I have a build task with “syntax” set to “gcc.sublime-syntax”, and saving that file after changes or a no-op results in Sublime Text iterating over every single file in the directory tree of the project which in this case includes FreeRTOS and I’d shudder to imagine what would happen had it included the Linux kernel tree. Sublime then generates the fifty-two thousand FS events show in this screenshot:

0 Likes

#4

Saving the .sublime-project or the gcc.sublime-syntax? The indexing needs to be done again when a syntax definition changes as it uses the syntax highlighting to find symbols. You can check the indexing status from the help menu or disable it entirely as previously stated.

1 Like