|
| 1 | +## Troubleshooting |
| 2 | + |
| 3 | +Because Sublime Text is so customizable, |
| 4 | +it is possible for third-party packages and/or local customization |
| 5 | +to interfere with one another or cause other problems. |
| 6 | +You might see this, for example, |
| 7 | +as Python exceptions that don't make sense in the Console Panel, |
| 8 | +or certain functionality isn't behaving as you expect. |
| 9 | + |
| 10 | +### Safe Mode |
| 11 | + |
| 12 | + |
| 13 | + |
| 14 | +Starting with version 4, |
| 15 | +you can launch Sublime Text in *Safe Mode* |
| 16 | +via the Command Line Interface: |
| 17 | + |
| 18 | +```sh |
| 19 | +subl --safe-mode |
| 20 | +``` |
| 21 | + |
| 22 | +Additionally on Windows and Mac, |
| 23 | +holding a modifier key while starting the application |
| 24 | +will open it in Safe Mode: |
| 25 | + |
| 26 | +* **Windows**: <Key k="shift+alt" /> |
| 27 | +* **Mac**: <Key k="option" /> |
| 28 | + |
| 29 | +When launched this way, |
| 30 | +Sublime Text uses an alternate [Data directory][], |
| 31 | +thus disabling all third-party packages and local customizations, |
| 32 | +as well as not loading any previously opened sessions. |
| 33 | +This will help you to verify whether the behavior you are observing |
| 34 | +is or is not coming from Sublime Text itself |
| 35 | +or one of its shipped packages. |
| 36 | + |
| 37 | +The alternate Data directory used is: |
| 38 | + |
| 39 | +* **Windows**: `%APPDATA%\Sublime Text (Safe Mode)\` |
| 40 | +* **macOS**: `~/Library/Application Support/Sublime Text (Safe Mode)/` |
| 41 | +* **Linux**: `~/.config/sublime-text-safe-mode/` |
| 42 | + |
| 43 | +Another nice aspect about Safe Mode is |
| 44 | +that you can perform experimental customizations |
| 45 | +or packages you think might have caused problems |
| 46 | +without affect Sublime Text's ability |
| 47 | +to start and behave normally, |
| 48 | +because: |
| 49 | + |
| 50 | +- such packages will be installed in the alternate Data directory, |
| 51 | + thus not impacting normal sessions, and |
| 52 | +- each time Sublime Text starts in Safe Mode, |
| 53 | + it deletes any content in the Safe Mode Data directory, |
| 54 | + so it "doesn't hurt" if a package installed there |
| 55 | + did something it wasn't supposed to. |
| 56 | + |
| 57 | +::: warning Caution |
| 58 | +**Do not store anything important in the Safe-Mode Data directory!** |
| 59 | +The data will be removed latest on the next Safe Mode start. |
| 60 | + |
| 61 | +**Do not install suspicious packages with Python plugins even in Safe Mode!** |
| 62 | +Python plugins still have access to the full Python library |
| 63 | +and can access your file system |
| 64 | +as if they were running natively on your system. |
| 65 | +::: |
| 66 | + |
| 67 | +After attempting to reproduce the behavior you observed previously in Safe Mode, |
| 68 | +you were either successful or not. |
| 69 | + |
| 70 | +**Reproducible in Safe Mode** |
| 71 | +: If the behavior is still being exhibited, |
| 72 | + it could be caused by a corrupted shipped Package file, |
| 73 | + which can be remedied by re-installing Sublime Text, |
| 74 | + or a bug. |
| 75 | + You can look for already reported bugs |
| 76 | + on the [official issue tracker][issue tracker] |
| 77 | + or report a new one |
| 78 | + if no existing one matches your situation. |
| 79 | + |
| 80 | +[issue tracker]: https://github.com/sublimehq/sublime_text/issues |
| 81 | + |
| 82 | +**Not Reproducible in Safe Mode** |
| 83 | +: If the behavior disappears, |
| 84 | + then you know it was caused by something in your Data directory. |
| 85 | + Follow the section below to narrow down the cause further. |
| 86 | + |
| 87 | + |
| 88 | +### Diagnosing Trouble from the Data Directory |
| 89 | + |
| 90 | +If you have reached the conclusion |
| 91 | +that the trouble you are experiencing has come from the Data directory |
| 92 | +(third-party packages and/or local customization), |
| 93 | +you can discover the source of the problem by following these steps. |
| 94 | +Knowing *when* the problem started is also an asset, |
| 95 | +because the cause will most likely have occurred |
| 96 | +just before the problem started. |
| 97 | + |
| 98 | +1. Close Sublime Text if it is running. |
| 99 | +1. Rename the [Data directory][] to another name |
| 100 | + to keep it as a backup and reference about |
| 101 | + what packages you installed and what customizations you made. |
| 102 | +1. Re-start Sublime Text. |
| 103 | + |
| 104 | +When Sublime Text starts, it will create a fresh new Data directory. |
| 105 | + |
| 106 | +::: tip Note |
| 107 | +In subsequent steps, |
| 108 | +it is recommended to keep |
| 109 | +the contents of the renamed problematic Data directory unaltered |
| 110 | +for the sake of preserving the evidence. |
| 111 | +This is so that if your first attempt at isolating the problem isn't successful, |
| 112 | +you can repeat it |
| 113 | +as many times as needed |
| 114 | +using smaller or different steps |
| 115 | +until you have isolated the problem. |
| 116 | +::: |
| 117 | + |
| 118 | +#### Diagnosis by Isolating Packages |
| 119 | + |
| 120 | +Now you can re-install third-party packages you had in place |
| 121 | +(and were working correctly) |
| 122 | +well before the problem started. |
| 123 | +You can install each package individually |
| 124 | +or multiple (related) packages in a group |
| 125 | +to speed up the process. |
| 126 | + |
| 127 | +Verify whether the problem is occurring after each increment. |
| 128 | + |
| 129 | +**The problem is *not* occurring** |
| 130 | +: Continue re-adding more packages |
| 131 | + until the behavior returns. |
| 132 | + |
| 133 | +**The problem *is* occurring** |
| 134 | +: Now you know the problem is somewhere in that group of packages, |
| 135 | + and you can take steps to further isolate the source |
| 136 | + by reverting and repeating this step |
| 137 | + with only half of the packages in the group. |
| 138 | + Keep dividing the group until you have isolated the source |
| 139 | + ideally to a single package. |
| 140 | + |
| 141 | +#### Diagnosis by Isolating Customizations |
| 142 | + |
| 143 | +If you have re-installed all third-party packages |
| 144 | +and the problem has not returned, |
| 145 | +now you can add your own customizations back in, |
| 146 | +one at a time, |
| 147 | +until the problem resurfaces. |
| 148 | +If/When you encounter the problem again, |
| 149 | +you will know where to investigate further to remedy, |
| 150 | +or, as the case may be, what *not* to do. |
| 151 | + |
| 152 | +[Data directory]: ../getting-started/basic-concepts.md#the-data-directory |
0 commit comments