Sublime Forum

Can we opt out of Snippets from stock packages?

#1

A lot of the stock language packages that come with Sublime have snippets in them.

For a given package, those snippets were presumably created by whoever authored the package, according to their own tastes regarding what would be cool/useful to have as snippets.

Unfortunately, I find myself hardly wanting to use any of these snippets, ever, and don’t want to have them to being constantly offered visually while typing!

Can we get a mechanism to opt out of snippets from stock packages?

1 Like

#2

there’s no simple way to do this atm, but it is possible - see

1 Like

#3

That linked proposal would be extremely nice as a general-purpose mechanism.

0 Likes

#4

I’d like to 2nd this request. I actually replace the entire Python and C++ packages. To do this I delete the supplied packages. But with the number of updates to ST4, each time it updates I have to delete them again. It would be nice if I could just tell the system to completely ignore the whole package.

0 Likes

#5

You can; there’s a setting for that:

	// List any packages to ignore here. When removing entries from this list,
	// a restart may be required if the package contains plugins.
	"ignored_packages": ["Vintage"]

Packages that are ignored are, as the name suggests, ignored. Nothing that they contain will be visible to Sublime. Note that in the case of Python and C++ (among other packages) that also makes the syntax definitions vanish away too.

If you just want to get rid of snippets and you’re using ST4, you don’t have to do either of those things because there’s a dedicated setting for this already:

	// A list of wildcard patterns specifying which snippet files to ignore.
	// For example, to ignore all the default C++ snippets, set this to
	// ["C++/*"]
	"ignored_snippets": [],

As you might expect (and have seen), when Sublime updates it updates it’s installation folder completely; that folder should be a “hands off” folder.

If you want to entirely remove a package, add it to the list of ignored_packages in your user preferences, and it’s contents will be wholly ignored whether it’s on disk or not.

You can also mask shipped packages in a “safer” way by creating an empty .zip file, renaming it to the appropriate package (say C++.sublime-package) and then dropping it into the Installed Packages folder. If a sublime-package file with the same name appears in both the install folder and Installed Packages, sublime will use the Installed Packages version.

Here “safer” is in the mysterious quotes because in doing this, you’re making sure for all time that no matter what happens in your copy of Sublime or how many times you reinstall it, you’ll never have access to the shipped package again unless you remember that you did this. You will receive 0 warning one way or the other. Confusion will likely ensue at some point in the future.

Hence, the settings are the better way to go.

5 Likes

#6

I didn’t think of the ignore option. That works great. I simply needed to name my replacement packages MyC++ and MyPython to prevent them from being ignored. Thank you.

0 Likes

#7

I have an update to this. I renamed my C++ and Python packages MyC++ and MyPython and added the C++ and Python packages to the ignore list. This works pretty well. I do have to close all open files to get them to recognize the new syntaxes. There is 1 issue however. The Command window apparently is hard coded to use the Python package syntax file. Now, whenever I open it I get a popup complaining that Packages/Python/Python.sublime-syntax cannot be found.

0 Likes

#8

What do you mean by Command window here?

0 Likes

#9

Sorry for taking so long to get back to you on this. The window triggered with ctrl+~. The first time this pops up it complains about the syntax file in a popup.

0 Likes

#10

Ahh I see; that is the Console window. The input in it indeed uses the Python syntax since it’s a Python console. Disabling syntaxes that are built in can be problematic at times. For example in this case Sublime assumes this package will be available. Also some syntaxes are embedded in others, so disabling some may cause problems.

If you’re using Sublime Text 4 (Help > About will report a build number that starts with a 4) what you want is this setting:

	// A list of wildcard patterns specifying which snippet files to ignore.
	// For example, to ignore all the default C++ snippets, set this to
	// ["C++/*"]
	"ignored_snippets": [],

You can use it to ignore snippets from packages while leaving them otherwise available, which was added specifically for cases like this.

If you’re on an older version of Sublime, use Preferences > Browse Packages to open the Packages folder, go inside the User package and create a file named Console Input Widget.sublime-settings (filename case should be considered important) and give it the following contents:

{
    "syntax": "Packages/Text/Plain text.tmLanguage",
}

That will turn off the Python syntax highlighting in the console input widget.

Either way, you probably want to re-enable the Python package.

0 Likes