Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #15169, snippets not loading correctly #15171

Conversation

dalanicolai
Copy link
Contributor

@dalanicolai dalanicolai commented Nov 20, 2021

The auto-completion layer seems not to have been designed/configured correctly.
So that, e.g., when using the julia layer, the auto-completion/init-yasnippet
function is called after the yasnippet-snippets package has been loaded.
Despite the yasnippet-snippets package containing an eval-after-load 'yasnippet, the form within that block is, for some reason, evaluated already
before auto-completion/init-yasnippet has been called.

Anyway, what happens currently is that first (yasnippet-snippets-initialize)
is evaluated, adding yasnippet-snippets-dir to the yas-snippet-dirs list.
Then auto-completion/init-yasnippet is called which contains the line (setq yas-snippet-dirs nil), setting the list to nil again.

As there is quite some logic involved (e.g. the order of evaluation is correct
when the julia layer is not being used), this commit fixes the reported issue by
simply calling (again) (yasnippet-snippets-initialize) from
auto-completion/init-yasnippet after the yas-snippet-dirs list has been
resetted to nil.

Any cleaner solution is welcome, but I would say this is a 'harmless' very
pragmatic quick fix/solution.

The auto-completion layer seems not to have been designed/configured correctly.
So that, e.g., when using the julia layer, the `auto-completion/init-yasnippet`
function is called after the `yasnippet-snippets` package has been loaded.
Despite the ``yasnippet-snippets` package containing an `eval-after-load
'yasnippet`, the form within that block is, for some reason, evaluated already
before `auto-completion/init-yasnippet` has been called.

Anyway, what currently happens is that first `(yasnippet-snippets-initialize)`
is evaluated, adding `yasnippet-snippets-dir` to the `yas-snippet-dirs` list.
Then ``auto-completion/init-yasnippet` is called which contains the line `(setq
yas-snippet-dirs nil)`, setting the list to nil again.

As there is quite some logic involved (e.g. the order of evaluation is correct
when the julia layer is not being used), this commit fixes the reported issue by
simply calling `(yasnippet-snippets-initialize)` from
`auto-completion/init-yasnippet` after the yas-snippet-dirs list has been
resetted to nil.

Any cleaner solution is welcome, but I would say this is a 'harmless' very
pragmatic quick fix/solution.
@dalanicolai dalanicolai force-pushed the fix-#15169-snippets-not-loading-correctly branch from 7f098db to 4da7e8c Compare November 20, 2021 16:14
Copy link
Collaborator

@smile13241324 smile13241324 left a comment

Choose a reason for hiding this comment

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

Good quick fix, we can look into the details later.

@smile13241324 smile13241324 merged commit f275553 into syl20bnr:develop Nov 20, 2021
thanhvg added a commit to thanhvg/spacemacs that referenced this pull request Dec 28, 2021
…bnr#15169

This reverts commit f275553.

This adds fix for julia layer breaking yasnippet set up.

Commit f275553 fixed a specific bug in julia
layer but it loads yasnippet and friends on start up which adds 1 sec to my
startup time even though I don't use julia.

Julia layer loads lsp-julia early on startup, which loads lsp who then loads
yasnippet behind the scene unknown to spacemacs and use-package. That's why our
nice and ordered setup for yasnippet and yasnippet-snippets failed as discused
in syl20bnr#15171. We now tell use-package to
defer its load.
thanhvg added a commit to thanhvg/spacemacs that referenced this pull request Dec 28, 2021
…bnr#15169

This reverts commit f275553.

This adds fix for julia layer breaking yasnippet set up.

Commit f275553 fixed a specific bug in julia
layer but it loads yasnippet and friends on start up which adds 1 sec to my
startup time even though I don't use julia.

Julia layer loads lsp-julia early on startup, which loads lsp who then loads
yasnippet behind the scene unknown to spacemacs and use-package. That's why our
nice and ordered setup for yasnippet and yasnippet-snippets failed as discused
in syl20bnr#15171. We now tell use-package to
defer its load.
thanhvg added a commit to thanhvg/spacemacs that referenced this pull request Dec 28, 2021
…nr#15169

This reverts commit f275553.

This adds fix for julia layer breaking yasnippet setup.

Commit f275553 fixed a specific bug in julia
layer but it loads yasnippet and friends on start up which adds 1 sec to my
startup time even though I don't use julia.

Julia layer loads lsp-julia early on startup, which loads lsp who then loads
yasnippet behind the scene unknown to spacemacs and use-package. That's why our
nice and ordered setup for yasnippet and yasnippet-snippets failed as discussed
in syl20bnr#15171. We now tell use-package to
defer its load.
smile13241324 pushed a commit that referenced this pull request Dec 30, 2021
This reverts commit f275553.

This adds fix for julia layer breaking yasnippet setup.

Commit f275553 fixed a specific bug in julia
layer but it loads yasnippet and friends on start up which adds 1 sec to my
startup time even though I don't use julia.

Julia layer loads lsp-julia early on startup, which loads lsp who then loads
yasnippet behind the scene unknown to spacemacs and use-package. That's why our
nice and ordered setup for yasnippet and yasnippet-snippets failed as discussed
in #15171. We now tell use-package to
defer its load.
thanhvg added a commit to thanhvg/spacemacs that referenced this pull request Dec 31, 2021
…nr#15169

This reverts commit f275553.

This adds fix for julia layer breaking yasnippet setup.

Commit f275553 fixed a specific bug in julia
layer but it loads yasnippet and friends on start up which adds 1 sec to my
startup time even though I don't use julia.

Julia layer loads lsp-julia early on startup, which loads lsp who then loads
yasnippet behind the scene unknown to spacemacs and use-package. That's why our
nice and ordered setup for yasnippet and yasnippet-snippets failed as discussed
in syl20bnr#15171. We now tell use-package to
defer its load.
eraad pushed a commit to datil/spacemacs that referenced this pull request Jun 10, 2022
…nr#15169

This reverts commit f275553.

This adds fix for julia layer breaking yasnippet setup.

Commit f275553 fixed a specific bug in julia
layer but it loads yasnippet and friends on start up which adds 1 sec to my
startup time even though I don't use julia.

Julia layer loads lsp-julia early on startup, which loads lsp who then loads
yasnippet behind the scene unknown to spacemacs and use-package. That's why our
nice and ordered setup for yasnippet and yasnippet-snippets failed as discussed
in syl20bnr#15171. We now tell use-package to
defer its load.
2ynn pushed a commit to 2ynn/spacemacs that referenced this pull request Jun 22, 2022
…nr#15169

This reverts commit f275553.

This adds fix for julia layer breaking yasnippet setup.

Commit f275553 fixed a specific bug in julia
layer but it loads yasnippet and friends on start up which adds 1 sec to my
startup time even though I don't use julia.

Julia layer loads lsp-julia early on startup, which loads lsp who then loads
yasnippet behind the scene unknown to spacemacs and use-package. That's why our
nice and ordered setup for yasnippet and yasnippet-snippets failed as discussed
in syl20bnr#15171. We now tell use-package to
defer its load.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants