Unfinished snippet is making my file get duplicated #675
-
Hello. The thing is, whenever I leave a snippet "unifinished", this meaning that I do not hit enter until I reach The snippet that happens me the most (because it is probably the one I use the most) is this: s(
{ trig = "jslog", dscr = "Javascript easier log", regTrig = false },
fmt(
[[ //TODO: Remove this debug line
Js.log2("{}", {}{});
]],
{
rep(1),
i(1),
i(0),
}
)
), As you can see, it is quite simple, but still very annoying, because I usually don't want to really finish this snippet, but it is mandatory to have one Let me know if you need more details to debug this, I don't want to overwhelm with my entire configuration |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 7 replies
-
Ah, yeah that's a problem without solution :/ |
Beta Was this translation helpful? Give feedback.
-
Oh, I clearly misunderstood the meaning. I thought it was "when to remove
the callbacks that do the region checks", but now it is clear. Do you mean
that you can set them to run during several events? What is the syntax? A
table of events?
El mié., 30 nov. 2022 9:16, L3MON4D3 ***@***.***> escribió:
… Ah, for that you can check #656
<#656>
Not sure what you mean with "predate each other", they are executed
completely independently, region_check_events leaves the snippet when the
cursor is outside it, and delete_check_events removes(/unlinks) the
snippet when its text was deleted (which does not happen automatically)
I have region... set to CursorHold,InsertLeave, and delete... to
TextChanged,InsertEnter, and that works pretty well.
—
Reply to this email directly, view it on GitHub
<#675 (reply in thread)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AARKJWLRW5Z5ZWJJHXZWEY3WK4EMVANCNFSM6AAAAAASNGEEWA>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
Perfect 👌 Gonna try that along with the suggested workaround
El mié., 30 nov. 2022 18:38, L3MON4D3 ***@***.***> escribió:
… Oh just a string, it's inserted verbatim into the autocommand-setup.
For example
ls.config.setup({
region_check_events = "CursorHold,InsertLeave",
delete_check_events = "TextChanged,InsertEnter",
})
—
Reply to this email directly, view it on GitHub
<#675 (reply in thread)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AARKJWIR7MGUYPRULMJUBJDWK6GJ3ANCNFSM6AAAAAASNGEEWA>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
Beta Was this translation helpful? Give feedback.
Ah, yeah that's a problem without solution :/
AFAIK the problem is that the buffer is deleted/it's content replaced completely, and this causes the extmarks which tracks the borders of the i(i) to expand to contain the entire file, and this is then repeated, duplicating the content.
This can be prevented by always jumping through the snippet(most comfortable via
region_check_events
, it jumps to the i(0) once the cursor is outside the region of the snippet), or disabling whatever is replacing the buffer(formatter?)