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

Conflicts With YASnippet #17

Open
JEG2 opened this issue Sep 13, 2012 · 6 comments
Open

Conflicts With YASnippet #17

JEG2 opened this issue Sep 13, 2012 · 6 comments

Comments

@JEG2
Copy link

JEG2 commented Sep 13, 2012

I simply love this mode and really want to use it all the time, but inserting snippets with YASnippet trips it up. Somehow, the initial snippet is not pushed down to the buffer. Because of that, the next change made indexes into the buffer string in bad spots. The parser recovers after the error, but the error is enough to cancel YASnippet's expansion, so they really don't peacefully coexist.

Ideally, it would be awesome to find a way to push down the YASnippet changes as they happen. If we can do that, this mode could keep parsing all the way through snippet expansion.

Another less ideal option is that YASnippet gives us before and after hooks. Is there someway I can disable the parser before expansion, then kick it back in after (somehow flushing the current buffer content to it)?

@JEG2
Copy link
Author

JEG2 commented Sep 15, 2012

I was able to work around this issue with these hooks:

(add-hook 'yas/before-expand-snippet-hook
          (lambda ()
            (if (eq major-mode 'ruby-mode)
                (remove-hook 'after-change-functions #'erm-req-parse t))))
(add-hook 'yas/after-exit-snippet-hook
          (lambda ()
            (if (eq major-mode 'ruby-mode)
                (erm-reset-buffer))))

It's not ideal, but it seems to allow the two libraries to play together.

@asok
Copy link

asok commented Oct 1, 2012

@JEG2 I am using this mode and yasnippets in version 0.7.0 and I'm not experiencing this problem. Maybe the culprit is something else in your setup?

@JEG2
Copy link
Author

JEG2 commented Oct 1, 2012

That's certainly possible, yes. I'll try to strip down my setup next time I have a chance to see if I can figure it out.

Just to be thorough though, did you test any multiline snippets with tab stops in them?

@asok
Copy link

asok commented Oct 2, 2012

Yes multiline snippets with tab stops work for me.

@JEG2
Copy link
Author

JEG2 commented Oct 2, 2012

Good to know. Thanks.

@zenspider
Copy link

I fixed this in the active fork. You can close this.

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

3 participants