Skip to content
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
123 changes: 103 additions & 20 deletions docs/guide/extensibility/packages.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,12 @@ Typical resources found in packages include:
- key maps (`.sublime-keymap`)
- macros (`.sublime-macro`)
- menus (`.sublime-menu`)
- commands (`.sublime-commands`)
- metadata (`.tmPreferences`)
- mouse maps (`.sublime-mousemap`)
- plugins (`.py`)
- settings (`.sublime-settings`)
- completions (`.sublime-completions`)
- snippets (`.sublime-snippet`)
- syntax definitions (`.sublime-syntax`, `.tmLanguage`)
- themes (`.sublime-theme`)
Expand All @@ -101,7 +103,7 @@ and you don't need to learn it.
while others enhance Sublime Text
to support common programming languages out of the box.

Examples: Default, Python, Java, C++, Markdown.
Examples: Default, Python, Java, C++, Markdown, reStructuredText.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why add reStructuredText, one of the worst syntax definition that ST currently ships with (though improvements are underway via sublimehq/Packages#4212)? Most people will not know what it is anyway.

If you want something different, I would add a serialization format for structured data types such as JSON, YAML or TOML there.

Copy link
Contributor Author

@vwheeler63 vwheeler63 May 24, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good question!

Actually, since the arrival of version 7 and 8 of the Sphinx documentation generator, I find that reStructuredText's popularity is growing very quickly. Here is a list of projects that are using it, and I THINK these are only the ones that the Sphinx project got permission to publish.

https://www.sphinx-doc.org/en/master/examples.html

I'm working on a MAJOR one for the LVGL graphics library.

And I too am working on a growing list of some Sublime Text utilities for reStructuredText.

The reason I included it was that "Markdown" was sitting there all alone, and, in my opinion, reStructuredText does a few things better than Markdown—especially with Sphinx. I don't know if you were aware, but the Linux project switched over to using Sphinx for its documentation a few years ago. This fact is what made me take a serious look at Sphinx and reStructuredText, and I have been a very happy user of it ever since. All of my documentation, book, and booklet projects now use it (about a dozen of them).

So my feeling is that it is quite appropriate to be there as an example.

If you have strong feelings about it, I can remove it, but after working in reStructuredText SOLID for the last 10 months, I'm convinced it's a winner! 😄

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

... and I too am working on a growing list of ST utils for reST ...

If you have anything to share, now would be a good time at sublimehq/Packages#4212

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you have anything to share, now would be a good time at sublimehq/Packages#4212

@jrappen I'm honored! See you there.


Located in `Shipped Packages`.

Expand Down Expand Up @@ -255,9 +257,16 @@ To create an override package,
create a new folder under `Packages`
and name it after the `.sublime-package` file
you want to override, excluding the extension.
Any file you create in this package
will take precedence over any identically named file
in the original package.

Any file you create in this package directory
will replace any identically named (and path-ed) file
in the original package. Sublime Text literally
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

literally identically identically literally ... maybe you could rephrase this

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

literally identically identically literally ... maybe you could rephrase this

Good catch! I think you will like how I re-worded it to be more graceful and intuitive.

However, one of the CI checks is failing on (I think) a build-tool version? I'm not sure if it is within my power to resolves. Can you have a look?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just pnpm audit showing some vulnerabilities in dependencies. You can ignore this.

(I should probably revise this to either only run in the publish action or not make the run fail.)

ignores the same-named file in the original
Package file. (This is unlike the effect of placing
files in the `User` Package where, for certain JSON
file types [settings, keymap, menu, completions,
commands and mousemaps] Sublime Text tries to
"merge" them into existing data.)

Python plugins in override packages
are able to use relative imports
Expand Down Expand Up @@ -299,22 +308,96 @@ Sublime Text loads packages in this order:
1. `Packages/User`


## Reverting Sublime Text to Its Default Configuration
## Troubleshooting

Because Sublime Text is so customizable, it is possible for 3rd-party Packages
and/or local customization to interfere with one another, or cause other problems.
You might see this, for example, as Python exceptions that don't make sense
in the Console Panel, or certain functionality isn't behaving as you expect.

### Safe Mode

As of Sublime Text 4, you can now launch Sublime Text in Safe Mode by using
this command from the command line to launch it.

subl --safe-mode

![Safe Mode Announcement](./images/safe_mode_announcement.png)

When launched this way, Sublime Text uses an alternate
[Data Directory](../getting-started/basic-concepts.md#the-data-directory),
thus disabling all 3rd-party Packages and local customizations, as well as
internally not loading any previous sessions (i.e. from any `.sublime-workspace`
files). This will help you to verify whether the behavior is, or is not,
coming from Sublime Text itself or one of its shipped Packages.

The alternate Data Directory used is:

* **Windows**: `%APPDATA%\Sublime Text (Safe Mode)\`
* **macOS**: `~/Library/Application Support/Sublime Text (Safe Mode)/`
* **Linux**: `~/.config/sublime-text-safe-mode/`

If the behavior is still being exhibited, it is most likely from a corrupted
shipped Package file and can be remedied by re-installing Sublime Text.

If the behavior disappears, then you know it was coming from somewhere in
the Data Directory.

A nice thing about Safe Mode is that you can install experimental
customizations or packages you think might have caused problems, and it will
not affect Sublime Text's ability to start and behave normally because:

- such packages will be installed in the alternate Data Directory, thus
not impacting normal sessions, and
- each time Sublime Text starts in Safe Mode, it deletes any content in
the Safe-Mode Data Directory, so it "doesn't hurt" if a package installed
there did something it wasn't supposed to.

**Caution:** don't store anything important in the Safe-Mode Data Directory!

### Diagnosing Trouble from the Data Directory

If you have reached the conclusion that the trouble you are experiencing has
come from the Data Directory (3rd-Party Packages and/or local customization),
you can discover the source of the problem by following these steps. Knowing
*when* the problem started is also an asset, because the cause will most
likely have occurred just before the problem started.

- Close Sublime Text if it is running.
- Rename the [Data directory](../getting-started/basic-concepts.md#the-data-directory)
to another name to keep it as a backup and reference about what
Packages you installed and what customizations you made.
- Re-start Sublime Text.

When Sublime Text starts, it will create a fresh new Data Directory.

Note: In subsequent steps, it is recommended to keep the contents of the
renamed (backup) of the problematic Data Directory unaltered for sake of
preserving the evidence. This is so that if your first attempt at isolating
the problem isn't successful, you can repeat it (using smaller or different
steps) as many times as needed until you have isolated the problem.

#### Diagnosis by Isolating Packages

Now you can re-install 3rd-Party Packages you had in place (and were working
correctly) well before the problem started. Test to verify whether the
problem is occurring after this step.

- If the problem is *not occurring* at this point, you can continue to
diagnose by re-adding each subsequent Package one by one, until the
behavior returns, at which point you will know what Package to exclude
or disable.

- On the other hand, if the problem ***is occurring***, you know the problem
is somewhere in that group of Packages, and you can take steps to further
isolate the source by reverting and repeating this step with only half of
the Packages, and keep dividing the group until you have isolated the
source.

Reverting Sublime Text to a fresh state
solves many problems
that appear to be bugs in Sublime Text
but are in fact caused by misbehaving
packages and plugins.
#### Diagnosis by Isolating Customizations

<!-- TODO --safe-mode -->
To revert Sublime Text to its default configuration
and remove all your settings and configurations,
delete the [Data directory](../getting-started/basic-concepts.md#the-data-directory)
and restart the editor.
Keep in mind
that the `Installed Packages` folder will be deleted too,
so you'll lose all your installed packages.
If you have reached this point and the problem has not returned, now you
can add your own customizations back in, one at a time, until the problem
resurfaces. If/when you encounter the problem again, you will know where
to investigate further to remedy, or, as the case may be, what *not* to do.

Always make sure to back up your data
before taking an extreme measure like this one!
Loading