SublimeText 3 using 100% CPU, "stuck while processing file" - sublimetext3

I've been using Sublime Text 3 for some time now, and over the past few weeks I've run into an issue where Sublime will spawn numerous processes, eating up 100% of my CPU.
Below is the output of wmic process where "name='sublime_text.exe'"
CommandLine ProcessId
"C:\Program Files\Sublime Text 3\sublime_text.exe" 10980
"/C/Program Files/Sublime Text 3/sublime_text.exe" "--crawl" "10980:crawl:1" 12152
"/C/Program Files/Sublime Text 3/sublime_text.exe" "--crawl" "10980:crawl:1" 8420
"/C/Program Files/Sublime Text 3/sublime_text.exe" "--crawl" "10980:crawl:3" 6016
"/C/Program Files/Sublime Text 3/sublime_text.exe" "--crawl" "10980:crawl:3" 12008
When I open Sublimes console, I see the following lines
worker 8420 appears stuck while processing file /D/dev/project/ext/index.html, killing process
worker 8420 appears stuck while processing file /D/dev/project/ext/build/index.html, killing process
I've since removed the entire /D/dev/project/ext folder from the index, and then I removed it from the project entirey, but that didn't seem to help.
Has anyone seen this before? I'd really rather not do a full re-install of Sublime.

You can try this:
shift + super + p:
{
"color_scheme": "Packages/User/SublimeLinter/Monokai Bright (SL).tmTheme",
"font_size": 13,
"folder_exclude_patterns": [".svn", ".git", ".hg", "CVS", "node_modules/*"],
"binary_file_patterns": ["*.jpg", "*.jpeg", "*.png", "*.gif", "*.ttf", "*.tga", "*.dds", "*.ico", "*.eot", "*.pdf", "*.swf", "*.jar", "*.zip"],
}
references:
Limit File Search Scope in Sublime Text 2

It may be the case that you have opened a project which contains 3rd party libraries.
In my particular case I have this kind of problem if I do not exclude from Project Index node_modules directory of some bigger node.js application.
Sublime Text tries to refresh index files on each run.
Add exclude pattern in your Project:
"folder_exclude_patterns":
[
"DIR_NAME"
]

I have had this question come up several times so I'd like to give a more complete answer.
What are they and how do I stop them?
The processes you see are the indexing workers which are parsing all of the files included in the side bar of your project(s) (yes, every single file) and building an index for Goto Anything. See Sublime Text 3 File Indexing.
Disabling All Indexing
This can be completely disabled by adding "index_files": false, to your Preferences.sublime-settings (Prefereces > Settings). To disable this system-wide, you add it to your Default settings file, or you can add it to your User setting file. Either will work.
Limiting the Scope of Indexing
However, if you would rather not disable indexing entirely, you can simply modify the scope of the files that are excluded from indexing:
(this is a good starting list, but feel free to edit to better fit your needs)
"index_exclude_patterns": [
"data/*",
"log/*",
"logs/*",
"node_modules/*",
"vendor/*",
"*.log"
]
Additionally, you might also want to expand what is considered a "binary" file (binaries are also excluded from indexing):
"binary_file_patterns": [
"*.bz2",
"*.cache",
"*.dds",
"*.eot",
"*.gif",
"*.gz",
"*.ico",
"*.jar",
"*.jpeg",
"*.jpg",
"*.pdf",
"*.png",
"*.swf",
"*.tar",
"*.tga",
"*.ttf",
"*.zip"
]
I have seen people suggest adding folders to the folder_exclude_patterns array, but that is the list of folders to hide from display in the side bar. While folders not displayed in the side bar will not be indexed, there might be files or folders that you do want displayed but don't want indexed; in such cases index_exclude_patterns should be used.
Limiting Indexing Per Project
Indexing exclusions can also be defined per project in the *.sublime-project file:
{
"folders":
[
{
"path": "src",
"folder_exclude_patterns": ["vendor"]
},
{
"path": "doc",
"index_exclude_patterns": ["*.md"]
}
]
}
Limiting the Number of Indexing Worker Processes
It is also worth noting that you can limit the number of indexing worker processes with "index_workers": 1, where 1 is the number of worker processes. By default that number is 0 which instructs Sublime to guess and the optimal number of workers based on the number of CPU cores available.

Removing the folder containing those two problem files did do the trick afterall, but only after I also removed the Javatar plugin. I've since added the Javatar plugin back, and I haven't add issues since, so if I were to guess is that when I removed the files project and restarted Sublime, the Javatar plugin still knew about them and was telling Sublime to index them. Once I uninstalled and reinstalled the Javatar plugin, after the files had been removed, everything seemed to work fine.

Related

How to ignore a folder in definition index for Sublime Text 3?

Sublime Text added a new feature to show function definition.
Do you know how to disable "dist" folder from the index?
There is a setting called index_exclude_patterns which can be used to exclude specific file patterns from the index. The default value of this is:
// index_exclude_patterns indicate which files won't be indexed.
"index_exclude_patterns": ["*.log"],
However it seems this can only specify file patterns, not directory patterns. So things like "dist", "dist*", "dist/" or "dist/*" do not work.
In this case a workaround is to amend the binary_file_patterns setting. The default for this is:
// These files will still show up in the side bar, but won't be included in
// Goto Anything or Find in Files
"binary_file_patterns": ["*.jpg", "*.jpeg", "*.png", "*.gif", "*.ttf", "*.tga", "*.dds", "*.ico", "*.eot", "*.pdf", "*.swf", "*.jar", "*.zip"],
Files that are binary are not indexed and so won't show up in the definition list.
Adding "dist/*" to the list of patterns should fix the problem up for you. Note that if you don't already have a custom setting for this you should probably copy the default first, otherwise things like images won't be considered binary any longer.
Changing the setting "folder_exclude_patterns" works for this, although the doc says its function is to control which folders are shown in the sidebar.

Sublime text 3 and overriding settings per project doesn't work

I've setup to my user settings on sublime text 3, the following option: trim_trailing_white_space_on_save: true
But it seems our collagues have a different opinion regarding of it and if it is useful. So I have to override this setting per project (I wanted to other projects, I just want to be skipped on a specific one). I've tried by creating a file .sublime-workplace and/or .sublime-project on the root of the project folder and I added the following:
{
"settings":
{
"trim_trailing_white_space_on_save": false
}
}
But when I save a file with whitespaces, it still keeps trimming them. What am I doing wrong? Is there specific settings which I can bypass per-project? If yes, is there another way of doing that (maybe a sublime plugin or something).
From the description in your question, the problem may be that you created the project file but didn't actually open it. Sublime only treats paths with a project file in them specially if you open the project, e.g. via Project > Open Project or from the command line via subl --project path/to/project.sublime-project.
Additionally, without a list of paths to include in the project, the project defaults itself to being empty, which is probably not what you want.
From your existing window that you're already working with, select Project > Save Project As... to save a project and workspace that captures the current state of everything; folders visible in the side bar as well as any files that may already be open. Once that's done you can use Project > Edit Project to edit the project file and add the setting as you did above.
Aside from that, a project file like the following saved into the folder you're using for your project will also do what you want; just remember to use Project > Open Project... or Project > Switch Project... to open the file you've created so that Sublime will use it.
{
"folders":
[
{
"path": "."
}
],
"settings":
{
"trim_trailing_white_space_on_save": true
}
}

Modify or extend default settings for a project

In a sublimetext3 project, is there a way to modify or extend, not replace, default settings?
To be specific, in a project I specify the paths of the folders to include in the project. Each folder has files and directories unique to that folder that I want to exclude using either folder_exclude_patterns or file_exclude_patterns; see documentation for Projects.
But as I understand this, these project settings replace not extend the default settings. What I would like, however, is to have a project setting that appends to the default pattern rather than replacing it. Is this possible?
Pseudo code that expresses what I would like to do:
"folders":
[
{
"path": "c:\\dir1",
"folder_exclude_patterns": default_folder_exclude_patterns + ["junk"]
},
{
"path": "C:\\dir2"
"folder_exclude_patterns": default_folder_exclude_patterns + ["old"]
},
]
If this is not possible, then I believe the only thing I can easily do is copy the default settings and replicate them for each folder item. Since I have multiple projects/folders and need to do this for file exclude, folder exclude and binary file settings, this will get tedious and be hard to maintain. Of course, this seems like it is ripe for a plugin, but that is not in the scope of what I am looking to do. (Of course if someone else has a plugin that does something like this, I would be happy to try it out! :-))
Unfortunately, due to the way Sublime is set up, higher-precedence settings replace lower-precedence ones, not supplement them. This is a good thing because many settings are either/or - what would you do if your user settings had "highlight_line": false while a project had "highlight_line": true, for example?
A plugin should be able to do the trick. sublime.Window contains the project_data() and set_project_data() methods, which allow you to retrieve and write project settings, respectively. You could add a "more_folder_exclude_patterns" key to each folder in your project with the additional patterns you would like to add to the defaults set in your Preferences.sublime-settings file. The plugin could then check if the "more" key exists, read both arrays, concatenate them, and write the result back to the .sublime-project file, erasing the "more" key at the same time. Finally, you could set up an event listener to run the plugin whenever you wanted - on save, upon loading a new file, etc.
EDIT
Here's a working example:
import sublime
import sublime_plugin
from copy import deepcopy
class ModifyExcludedFoldersCommand(sublime_plugin.WindowCommand):
def run(self):
proj_data = self.window.project_data() # dict
orig_proj_data = deepcopy(proj_data) # for comparison later
settings = sublime.load_settings("Preferences.sublime-settings")
fep = settings.get("folder_exclude_patterns") # list
for folder in proj_data["folders"]:
try:
if folder["folder_exclude_patterns"]:
break # if f_e_p is already present, our work is done
except KeyError:
pass # if it doesn't exist, move on to mfep
try:
mfep = folder["more_folder_exclude_patterns"]
new_fep = sorted(list(set(fep + mfep))) # combine f_e_p from
# Preferences and project,
# excluding duplicates using
# a set.
folder["folder_exclude_patterns"] = new_fep
del folder["more_folder_exclude_patterns"]
except KeyError:
pass # if mfep doesn't exist, just move on to the next folder
if proj_data != orig_proj_data:
self.window.set_project_data(proj_data)
class UpdateProjectData(sublime_plugin.EventListener):
def on_activated(self, view):
window = view.window()
window.run_command("modify_excluded_folders")
Save the file as Packages/User/modify_excluded_folders.py (where Packages is the folder opened when selecting Preferences -> Browse Packages...) and it should go into effect immediately. It will run each time a view is activated. It checks for the presence of a "folder_exclude_patterns" array in each folder defined in the current .sublime-project file, and if found it assumes everything is OK and passes on to the next folder. If that array is not found, it then checks for the presence of a "more_folder_exclude_patterns" array. If found, it does its magic and merges the contents with the existing "folder_exclude_patterns" array from your preferences (Default or User). It then writes a new "folder_exclude_patterns" array into the folder and deletes the "more_folder_exclude_patterns" array. Finally, it checks to see if any changes were made, and if so it writes the new data back to the .sublime-project file.

Why is Find in Files in Visual Studio Code OSX ignoring my search.excludeFolders setting?

Even with the default configuration, I still get tons of results in various node_modules folders when doing a workspace search.
Default setting:
"search.excludeFolders": [
".git",
"node_modules",
"bower_components"
],
I've even tried copying to my user settings and changing to several variants, such as "/node_modules", "/node_modules/", etc.
I've already seen the other post in vscode about this issue: How can I choose folders to be ignored during search? . This answer doesn't solve my issue.
I'm using Version 0.1.0 on OS X (commit d13afe1). Any chance there's a bug with exclude folders?
After reading again your question and trying it out, only now I notice that the search.excludeFolders values apply only to the workspace root. So, for a node_modules folder in your hierarchy, you would need to use:
{
"search.excludeFolders": [
".git",
"node_modules",
"bower_components",
"path/to/node_modules"
]
}
These preferences appear to have changed since #alex-dima's answer.
App -> Preferences -> User/Workspace Settings
You can choose custom settings that will apply to searches. For example, I am developing an EmberJS application which saves thousands of files under the tmp directory.
Picture of search before updating settings.
After updating the Visual Studio settings.
{
"search.exclude": {
"**/.git": true,
"**/node_modules": true,
"**/bower_components": true,
"**/tmp": true
}
}
Note: Include a ** at the beginning of any search exclusion to cover the search term over any folders and sub-folders.
The search results are exactly what I want.
Picture of search after updating settings.

How do I configure Textmate2 to turn off Soft Wrap by default for all files?

I put a .tm_properties file in my home folder and also at the top of my source tree with the following in it, none of the versions had any effect.
softWrap = false
softWrap = :false
softWrap=false
Also with no effect, I put the line below section headers such as:
[ source ]
[ text ]
[ "*.*" ]
Would love to know what I'm missing here.
I have the following entry below and it work just fine. Try removing other file type specific configuration to ensure its not being overridden.
softWrap = false
Also do check the "global" defaults under
TextMate.app/Contents/Resources/Default.tmProperties
If you haven't already seen https://gist.github.com/1478685, do check it out. The tm_properties in your most immediate folder should take priority. So try and remove other setting and just test it with this one.
Alternatively, remove all other tm_properties and just leave the "global" one and test it out.
Finally do check out this discussion and the version of TM2 you are using. There have been certain fixes to softwarp, and it could just be a bug that you are facing.
EDIT
Also just FYI, I found this item in the latest release notes of TM2.(2012-02-18)
Cached .tm_properties files are now observed via kevent so changes invalidate the cache immediately (previously it could take up to 30 seconds before the updated file was read). On file systems without kevent support you need to relaunch TextMate to flush the cache.

Resources