Closed AnthonyDiGirolamo closed 8 years ago
Thank you, very interesting! I'll look into it. Its strange that the indentation changed depending on if we're using Yasnippet or not.
I've done some debugging to figure out the differences. It seems like YASnippet uses a function called yas--indent
after inserting the snippet text into the buffer, while Yankpad (without yas-minor-mode
does not). If you mark the text inserted with yas-minor-mode
disabled, and press tab
, you will see that the result is the same as if you had yas-minor-mode
enabled. It is also interesting if you try the same example but with fundamental-mode
instead of ruby-mode
.
I'll have to look more into the indentation mechanics of YASnippet and Emacs, in order to see how this should be handled in Yankpad.
I've pushed an update which should fix the issue. By default the snippets are indented (so your example should work), but you can disable that by adding a tag indent_nil
to the snippet.
Thanks for the great package! I've been avoiding yasnippet because of the one snippet per file restriction. This fixes that perfectly.
I'm running into an issue with incorrect indentation when inserting snippets without yasnippets enabled. I'm not sure if it's my indentation settings or yankpad. Given the following
yankpad.org
And the test file:
When I run
yankpad-expand
with the cursor after eachif
I get the following with and without yas-minor-mode enabled respectively:$1
and$0
not being there when yasnippet is disabled is expected. But the indentation for the next four lines after the initialif
is off. They are all unindented one more level than expected. I can of course leave yasnippet installed to fix this but thought you may want to know anyway.