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

spacemacs/helm-yas(SPC i s) breaks the # condition: system of YASnippet #14105 #21

Open
nfedyashev opened this issue Nov 17, 2020 · 5 comments

Comments

@nfedyashev
Copy link

Description :octocat:

Something must be wrong with helm-yas because it ignores(or caches?) the results for autocompletion. # condition: is unusable with helm-yas

Reproduction guide 🪲

Create the following snippet:
1.

cat enh-ruby-mode/big-number
# -*- mode: snippet -*-
# name: ruby big number digit readable human
# condition: (= (line-number-at-pos) 1)
# --
100_000_000_000
  1. Open any .rb file or just switch to ruby-mode/enh-ruby-mode.
  2. Navigate to any line that is not the first one and execute SPC i s(spacemacs/helm-yas)
  3. Start typing e.g. "number"

Observed behaviour: 👀 💔
"ruby big number digit readable human` is listed in autocompletion mode(condition is ignored)

Expected behaviour: ❤️ 😄
"ruby big number digit readable human" snippet name must be available in auto-completion only on the first line(when a condition is true)

This issue is only reproducible in helm-yas. When I run yas-insert-snippet command instead it works fine! # condition: is properly checked and only the matching snippets are displayed.

System info

yasnippet pkg info 20200604.246
helm-c-yasnippet pkg info 20200520.1519
Spacemacs branch - develop

@syohex
Copy link
Member

syohex commented Nov 17, 2020

@nfedyashev Thanks for reporting issue. I wrote a patch, could you check #22 code ? I don't understand yasnippet condition parameter.

@nfedyashev
Copy link
Author

nfedyashev commented Nov 18, 2020

@syohex thanks for taking the time to write that pull request!

that's how I tried to check if it solved the issue:

  1. set an explicit path to helm-c-yasnippet package:
  • '((helm-c-yasnippet :location (recipe :fetcher github :repo "emacs-jp/helm-c-yasnippet" :branch "syohex/condition-issue")))
    
  1. tried to reproduce the issue with master and syohex/condition-issue branches using spacemacs/helm-yas and yas-insert-snippet. After each time I restart my emacs.

I didn't notice any difference in condition handling between those 2 branches. The issue is still the same.
Do I need to recompile all packages? I didn't

I originally reported this issue in spacemacs project - syl20bnr/spacemacs#14105 (comment) and a suggestion was to report it as helm-c-yasnippet issue instead.

@syohex
Copy link
Member

syohex commented Nov 18, 2020

Do I need to recompile all packages? I didn't

If you have old byte-compiled file, then please remove it or re-compile.

sample

⬆️ is syohex/condition-issue branch behavior. At first line, there are two candidates, while there is one candidate at second line.

@nfedyashev
Copy link
Author

nfedyashev commented Nov 18, 2020

I did spacemacs/recompile-elpa
yas/recompile-all
yas-reload-all
(byte-recompile-directory (expand-file-name "~/.emacs.d") 0)

None of these commands work for me:

helm-yas-complete
spacemacs/helm-yas
helm-yas-complete
helm-c-yas-complete

The only one that works is yas-insert-snippet .. which still uses helm for autocompletion if I got it right.

@syohex
Copy link
Member

syohex commented Nov 18, 2020

@nfedyashev Sorry I don't understand spacemacs well. I have merged #22. Could you reinstall latest version of master branch and re-compile and check ?

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

No branches or pull requests

2 participants