-
Notifications
You must be signed in to change notification settings - Fork 311
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
Suggestion: not preceded by space #1188
Comments
Here's my suggestion: is there an easy way to make certain snippets delete
one more character than they currently do? "Space-gobbling snippets" might
solve a problem by removing the unwanted space after the fact.
Hmm... is a space really always present? I don't use YASnippet enough
to know, but I'd expect that YASnippets can be expanded even if placed
right after an open paren, for example.
Also, YASnippet usually (re)indents the code resulting from the
expansion, so it will already insert/delete space at the beginning in
some of those cases.
IOW, I think it would help if you could collect/list some examples where an
extra space is needed to perform expansion (and would benefit from being
deleted afterwards).
|
monnier ***@***.***> writes:
> Here's my suggestion: is there an easy way to make certain
> snippets
delete
> one more character than they currently do? "Space-gobbling
snippets" might
> solve a problem by removing the unwanted space after the fact.
Hmm... is a space really always present? I don't use YASnippet
enough to know, but I'd expect that YASnippets can be expanded
even if placed right after an open paren, for example.
Also, YASnippet usually (re)indents the code resulting from the
expansion, so it will already insert/delete space at the
beginning in some of those cases.
IOW, I think it would help if you could collect/list some
examples where an extra space is needed to perform expansion
(and would benefit from being deleted afterwards).
- Reply to this email directly, view it on GitHub, or
unsubscribe. You are receiving this because you authored the
thread.*Message ID:
***@***.***>
Scenario: typing the text trigger for a snippet, but the snippet
in question is meant to directly follow the previous character
without a space between them. But if I really type the snippet
trigger without putting a space before it, it isn't the trigger
anymore.
Am I only asking this question because I've misunderstood
something?
…--
David
|
Scenario: typing the text trigger for a snippet, but the snippet
in question is meant to directly follow the previous character
without a space between them.
No, no, I meant a concrete scenario:
- in which major mode?
- which specific snippet(s)?
- what would the text just (which doesn't end in a space) before typically look like?
Stefan
|
There might be an even better way of utilizing this variable, but this is the simplest solution that comes to mind. |
I've seen at least a couple of issues asking essentially the same thing: how to expand a key without putting a space before it, because the desired output must not contain a space at the place where the snippet is being added. Clearly, this isn't possible.
Obviously, a snippet replaces its key, and doesn't just appear beside the key; this means every snippet already deletes characters from the buffer.
Here's my suggestion: is there an easy way to make certain snippets delete one more character than they currently do? "Space-gobbling snippets" might solve a problem by removing the unwanted space after the fact.
The text was updated successfully, but these errors were encountered: