emacs-jp / helm-c-yasnippet

Helm source for yasnippet
29 stars 8 forks source link

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

Open nfedyashev opened 3 years ago

nfedyashev commented 3 years ago

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 :beetle:

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: :eyes: :broken_heart: "ruby big number digit readable human` is listed in autocompletion mode(condition is ignored)

Expected behaviour: :heart: :smile: "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 commented 3 years ago

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

nfedyashev commented 3 years ago

@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")))
  2. 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 - https://github.com/syl20bnr/spacemacs/issues/14105#issuecomment-727280336 and a suggestion was to report it as helm-c-yasnippet issue instead.

syohex commented 3 years ago

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

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

nfedyashev commented 3 years ago

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 commented 3 years ago

@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 ?