Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Ensure snippets are displayed in a package’s settings view. #1084
Add an “Enable” checkbox inside the snippet view to add/remove the current package from the snippets blacklist.
Description of the Change
An “Enable” checkbox has been added at the top of the section — identical to the one at the top of a Keybindings panel. Just as unchecking the Keybindings panel’s Enable checkbox immediately disables that package’s key bindings, unchecking the Snippet panel’s Enable checkbox immediately disables all snippets provided by that package. No reloading of the window is necessary.
The snippets themselves are listed in the table with columns for prefix, name, scope, and body. Since the body of a snippet is arbitrary text of arbitrary length, we don’t show it in the table; we show it in a tooltip that is shown when the View button is clicked. The Copy button writes a string to the clipboard that can be pasted into a user’s
I mooted this change in #1076 before contributing this PR because I wasn’t yet certain how snippet bodies ought to be displayed in the UI.
First of all, this fixes the bug (described in #1076) that prevented a package's settings page from listing snippets altogether.
This is also the UI side of atom/snippets#277, which allows package-provided snippets to be disabled on a per-package basis. This is one of the oldest and most-requested enhancements for the snippets package.
Can't think of any. This fixes a regression. We were already paying the cost of retrieving the snippets for display in
Thanks for contributing
This is looking great. I left two comments below.
OK, the last commit addresses all feedback. @Ben3eeE, I fixed the issue with newlines when copying to the clipboard, and I changed the specs to cover that scenario. But since those tests are now version-guarded they won't run unless you temporarily change the spec file just to verify it.
(Also updated atom/snippets#277 to expose
Huh I'm getting this error when trying to test out the changes. I don't know why I definitely pulled and linked both the settings-view and snippets pr. I'll check more tomorrow.
I noticed another thing. The bundled snippets in the snippets package do not show up in the settings for the snippets package so those can't be disabled or copied. I am not sure if they have ever shown up in the settings. This is not something that we have to address now and can open an issue for.
I bet that's a legit error. It occurred to me that I didn’t actually test out the functionality after that change — I only ran the specs. But the specs use a mock snippets provider, so I haven't tested the integration at all. I'll look at that shortly.
I think this happens for any package that is currently
Anyway: fixed the error @Ben3eeE reported (settings-view wraps the snippetsProvider for some reason) but CI is still being ornery. I’m not sure why it fails on AppVeyor. The previous iteration passed on stable but failed on beta, and now it's failing both.