joaotavora / yasnippet

A template system for Emacs
http://joaotavora.github.io/yasnippet/
2.76k stars 314 forks source link

Less fragile placeholders #1025

Open casouri opened 4 years ago

casouri commented 4 years ago

(Below is in eglot's symbol completion context)

Currently, the placeholders are more or less one-time-only: if I tab over them or clicked somewhere else, the special properties go away and I'm left with normal text. Then I need to manually remove the text. It just feels fragile and I often mess up. Is it possible to make the placeholders stick around until I manually delete them or type on them?

Basically, I'm looking for something like Xcode placeholders.

IIUC, the snippet expansion exits when the user arrives at the last tab stop. But could you let the overlay on unmodified placeholders be? Maybe add a evaporate property and let the user decide whether to remove them.

I understand it could be complicated. The modification hook seems to do a bunch of complicated stuff involving nested expansion and accessed some seemingly temporary variables, so maybe it's not that easy...

Xcode placeholder:

xcode-snippet

npostavs commented 4 years ago

Is it possible to make the placeholders stick around until I manually delete them or type on them?

Might be doable, but I suspect there will be a lot of unexpected complications.

casouri commented 4 years ago

Probably. Anyhow, let me leave this open in case someone is interested.