Skip to content

Conversation

@npostavs
Copy link
Collaborator

@npostavs npostavs commented Apr 2, 2020

Resolve #998

@maikol-solis
Copy link

maikol-solis commented Jun 23, 2020

Just a little bug found.

If you have a snippet for latex like this

# -*- mode: snippet -*-
# name:hat
# condition: (and (texmathp) 'auto)
# key: hat
# --
\hat{$1}

and you type hat it correctly expands to \hat{}. However, if you pass multiple times your cursor by the word hat in the expanded snippet, it will expand forever like this \\\\\\\hat{}{}{}{}{}{}{}{}{}.

Normally, a snippet should be inactive and stay there once is expanded. If the user types or erases some characters, I think the snippet could be expanded again.

Great feature by the way.

@joaotavora
Copy link
Owner

YOu probably want to check this-command or last-input-event or something like that. I recommend this-command. Check that it is self-insert-command. Good luck.

@ywangmy
Copy link

ywangmy commented Apr 16, 2023

Hi! I encounter an issue that, after I press tab after a snippet is automatically expanded using this condition, the cursor jumps to the last "Tab stop field" (of some previous snippet). Do you know what the possible cause is? Thank you.

Details:

  • the previous snippet:
# -*- mode: snippet -*-
# name: LaTeX dint
# type: snippet
# key: dint
# condition: (and (texmathp) 'auto)
# --
\\int_{${1:a}}^{${2:b}} $0
  • the snippet being expanded:
# -*- mode: snippet -*-
# name: LaTeX square
# type: snippet
# key: sr
# condition: (and (texmathp) 'auto)
# --
^2$0
  • context:
\int_{0}^{1} x 
% I type 'sr' and it expands to '^2'. Then I press tab, and the cursor jumps to the points after '{1'
  • Message: yas--find-next-field: Wrong type argument: yas--snippet, nil

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.

expand with no trigger key

4 participants