Closed Blaisorblade closed 6 years ago
Yasnippet no longer bundles snippets directly, but it's very easy to get some!
source: https://github.com/joaotavora/yasnippet#where-are-the-snippets
The Spacemacs auto-completion
layer has added the yasnippet-snippets
package on the develop
branch:
auto-completion: add yasnippet-snippets #10156
I'm not sure what the fix is on the master
branch.
Maybe yasnippet
is able to see the snippets if yasnippet-snippets
is installed
(add it to the dotspacemacs-additional-packages
variable in .spacemacs
).
Or maybe the path to the snippets need to be specified manually, by setting the yas-snippet-dirs
variable, like in the example from the url above:
(setq yas-snippet-dirs
'("~/.emacs.d/snippets" ;; personal snippets
"/path/to/some/collection/" ;; foo-mode and bar-mode snippet collection
"/path/to/yasnippet/yasmate/snippets" ;; the yasmate collection
))
I can confirm, adding yasnippet-snippets
to dotspacemacs-additional-packages
fixes the issue
@deisi that worked for me too! So I guess yasnippet-snippets
should also be added to the master branch, by backporting #10156 and 091800b2?
Or just wait for develop to be merged into master with the next release. I'm happy enough for now, so closing the issue.
In case anyone else ends up here via search like I did:
yasnippet-snippets
to dotspacemacs-additional-packages
does NOT fix it.yas-snippet-dirs
DOES fix it, but defeats the purpose of the auto-complete
layer.The problem is that the auto-complete layer adds a no-longer existing directory to yas-snippet-dirs
which causes yas-snippets to complain on initialization.
This is all fixed in the develop branch which is now a year ahead of master.
Is this going to be merged to master anytime soon ?
Guessing this still hasn't been merged in?
You are right, these changes were not released to master yet, but unfortunately I don't have an ETA for the next release.
The next release from develop will take a while, interested users can either switch to develop or contribute a backport of #10156.
I don't think main has been updated for a while.
@Blaisorblade how could I help with backporting? I'd be starting from square 0 w/ this, I'm a vim user of spacemacs who doesn't do much configuration outside of adding lines into my .spacemacs flie
2019, and still seeing this.
Is there something we can do to help?
I've the same problem with the directories.
I too.
Switching to develop branch fixes the issue:
cd
cd .emacs.d
git fetch origin
git checkout develop
# restart emacs
Why is this issue marked "closed" when the fix still hasn't been merged into master?
The issue author said the following in the comment above: https://github.com/syl20bnr/spacemacs/issues/10316#issuecomment-367426093
I'm happy enough for now, so closing the issue.
The develop
branch is the recommended branch until the next version is released (I have no insight into when that is).
develop
branch:Backup your current setup and make sure that there isn't a .emacs.d
directory or a .spacemacs
file in your home directory. Then navigate to your home directory in a terminal (or command prompt) and clone directly to the develop
branch with:
git clone -b develop https://github.com/syl20bnr/spacemacs .emacs.d
The
develop
branch is the recommended branch until the next version is released (I have no insight into when that is).
👍 in practice, I've been using develop
for ages — not sure the recommendation is official but it's reasonable.
I've found out very recently that my snippet tables were empty!
The auto-completion layer ensures yasnippet-snippets is available
And yasnippet-snippets autoloads yasnippet-snippets-initialize
(eval-after-load 'yasnippet
'(yasnippet-snippets-initialize))
~But I found out that yasnippet-snippets-initialize
was apparently not being run. I am guessing that maybe it has to do with using eval-after-load
.~
~My current workaround consists of adding~
(use-package yasnippet-snippets
:defer t
:config
(yasnippet-snippets-initialize))
to my dotspacemacs/user-config
@stormwatch According to https://github.com/syl20bnr/spacemacs/pull/10156#issue-288443684
Note yasnippet-snippets does not need to be initialized with use-package; simply installing it and putting it in the load-path is enough for yasnippet to find the snippets.
What I found is:
yasnippet
nor yasnippet-snippets
is loaded, which is the correct behaviour as we want packages to be lazily loaded.yasnippet-snippets
added its yasnippet-snippets-dirs
to yas-snippet-dirs
.
yasnippet-snippets-dirs
is not set, since the package is not yet loaded.yas-snippet-dirs
is set. But it says that yas-snippet-dirs
is a variable without a source file. This is because this symbol is initialized in auto-completion-layer
, rather than being declared in yasnippet
which is not yet loaded.yasnippet
is enabled, you'll find both packages are loadedyasnippet
is loaded, you can manually run (require 'yasnippet)
and you'll find yasnippet-snippets
is also loaded.That is to say, there's no need to call yasnipeet-snippets-initialize
manually.
@lebensterben Thank you!
Description :octocat:
On Spacemacs stable, since a few weeks, upgrading yasnippet gives on each reboot a warning such as
until I manually create the named folder. Since the folder name is version-based, the warning is triggered anew with each upgrade.
I also suspect the content of the folder isn't migrated with the upgrade.
Reproduction guide :beetle:
Observed behaviour: :eyes: :broken_heart:
Expected behaviour: :heart: :smile:
No warning.
System Info :computer: