Sublime Forum

Snippet SNAFU

#1

I finally found out that my snippets are not found if placed in a folder named Packages/User/Markdown.

If I rename it into Packages/User/MD the snippets placed there are working.

Why is that? Is there any special meaning to Markdown folders? Tested on a fresh install with V3.2.1 B3207.

0 Likes

#2

here is a portable, standalone version of the feature for linux:

> write `markdown_snippet` and press [[TAB]]
> to trigger the snippet

markdown_snippet

> write `user` and press [[TAB]]
> to trigger the snippet

user

Is there any documentation available? The 2nd snippet does not trigger.

  1. download here
  2. extract folder
  3. start sublime_text

P.S.: NO NEED TO SIGN UP OR SIGN IN, please click “No, thanks”

0 Likes

#3

Can you post your ignored_packages list from the preferences?

1 Like

#4

Preferences.sublime-settings - User:

{
	"ignored_packages":
	[
		"Markdown",
		"MarkdownEditing",
		"Vintage"
	]
}

so it wasn’t working because I had a plug-in “Markdown” installed. When I disabled the plug-in it still wasn’t working becaus it had been ignored. :woozy_face:

0 Likes

#5

I seem to recall that a bug was reported where ignored_settings would match in the middle of resource paths rather than only at the beginning. I couldn’t find a link in a brief search.

0 Likes

#6

this describes the scenario in my real configuration. They are actually subfolders. I ended up renaming all my folders adding a suffix to them.

I think with expected behaviour if I disable a package all are being ignored if they have the same name in the following root locations:

  • Installed Packages/
  • Packages/
  • User/Packages/

Troubleshooting snippets can go a long way. Usually they don’t work due to wrongly escaped characters.

Thank you for the help, I was going insane.

0 Likes

#7

I noticed this too. When I had the default Go package added to ignored_packages, some snippets I had in my own directory hierarchy at User/Snippets/Go stopped being picked up. I renamed that directory of mine to have an underscore suffix as a workaround.

0 Likes

#8

it’s by design. I’ve never heard of any best practices but a suffix is highly recommended - better save than SNAFU. I felt a bit stupid after @ThomSmith mentioning ignored_settings, but this is certainly not the first thing that comes to mind. And, ignoring packages is one of the first things I do to rule things out and this side effect is less than ideal.

0 Likes

#9

It is clearly a bug, because only a direct child of Packages/ is a “package”. Anything deeper than that is simply a directory and so shouldn’t be affected by the setting called ignored_packages

2 Likes

#10

every direct child of the above locations is a package.

There are cases where you genuinely want to exactly match the names in order to override default behaviour.

Therefore, every package must have a unique name and there shouldn’t exist any packages with a generic name such as Go. Yet, there is.

If the package developer and the user are both simultaneously slacking on a unique name unexpected behaviour can occur. I did the same mistake, not once but several times.

Note that snippets can be overritten as well.

0 Likes

#11

But self-created directories at User/Snippets/Go and User/Markdown are not packages, and are not overrides either.

With respect, I feel you may be confused about what is/isn’t an actual Override. If you haven’t tried it, this is a very good tool to understand overrides in Sublime: https://packagecontrol.io/packages/OverrideAudit

0 Likes

#13

The discussion about this particular issue (or rather, the underlying cause of it) was on Discord in reference to this issue in mdpopups, where it was ultimately discovered that when a package is ignored, resources that contain that package name can’t be loaded.

The below issue covers the same ground (and is likely why @facelessuser didn’t log the issue directly himself).

1 Like

#14

I didn’t log it because I was busy…and forgot :sweat_smile:. But glad someone is covering it!

This is definitely something that needs attention as it throws people for a loop. Had me scratching my head for a long time.

1 Like

#15
0 Likes