hsnips
hsnips copied to clipboard
placeholder disappears when using the automatic snippet
Hello, I've got a problem that behaves kind of like https://github.com/draivin/hsnips/issues/38, but I don't know how to fix it. I have this two snippets
snippet lim "auto limit" w
\lim\limits_{${1:n} \to ${2:\infty}} $0
endsnippet
`(?<=\b|\d+)(?<!\\)(tau)` "greek" wA
\\``rv = m[1]``$0
endsnippet
When I'm in the lim
snippet, and then I type in tau
, it will change into \tau
but make the placeholer disappear.
Could anyone gives some tips about that problem?
I think that your snippet should be:
snippet lim "auto limit" w
\lim\limits_{${1:n} \to ${2:\infty}} $0
endsnippet
snippet `(?<=\b|\d+)(?<!\\)(tau)` "greek" wA
\\``rv = m[1]``$0
endsnippet
but I think everything is okay...
Can you provide more information? or...🤔
Can you provide more information? or...🤔
@yfzhao20 Hello! Actually I'm working on my math homework, one is with latex in wsl2-Ubuntu20.04 and another one is with markdown in Win10. I've fully tested on both systems and found something really strange:
-
When I'm using latex in WSL2, hypersnips works quite well, like that:
-
However when I'm using markdown in Win10, the strange behaviour described above happened:
Maybe the cause is the difference between these two languages? I've no idea about how to fix this problem..
I've tested this problem again in Win10 (at least in WSL2 everything is fine).
This problem happens only when the auto completion is triggered, if I use tab
to complete there is no problem.
I doubt that there maybe some conflicts between hypersnips
and vim
.
- I tested latex in Win10 and the problem still exists, so I think the language doesn't matter.
- I disabled most of my extentions, and the problem was gone.
- Finally I found that when I enabled the
vim
extention, the problem came again! - However, in the remote-wsl mode, I enabled all my extentions and there was no such problem.
The testing procedure is as follows:
Sorry but I don't use "vim" as editor. So maybe I have tried my best 😂 Maybe you can check your snippets in "Vim"?
Sorry but I don't use "vim" as editor. So maybe I have tried my best 😂 Maybe you can check your snippets in "Vim"?
I delete all my vscode-vim
configuration in the settings.json, but the problem still exists...
So there must be some conflicts between these two extensions.
Actually I'm trying to use vscode to write latex/markdown, so I choose the vscode-vim + hypersnips
extensions in substitution for vim + UltiSnips
.
However there are quite a lot of difference between hypersnips
and UltiSnips
, maybe the author knows how to fix this problem.
Anyway, thanks a lot! @yfzhao20
I also use VScodeVim+hypersnips, and I got the same problem 😂
I also have the same problem. But it will be fine trying the plug named VSCode Neovim to replace the Vim plug.
Same here with simple snippets:
snippet ab "Ab" A
a $1 b
endsnippet
snippet cc "Cc" A
cc
endsnippet
Typing abcc
lock me at |
in a cc| b
and I can't use tab to go to the end (a cc b|
) once the cc snippet expanded.
Using Vscode + Vim + Hsnips.
So, I looked into it, the placeholder disappearance is caused by a workaround we are currently using to get around a VsCodeVim issue.
History time:
- We started using the workaround to get around this issue https://github.com/draivin/hsnips/issues/28.
- Supposedly, the related issue in VSCodeVim was fixed here https://github.com/VSCodeVim/Vim/issues/5240.
- I'm not sure if it was never properly fixed, or if a regression happened, but it seems that the issue still exists (see https://github.com/VSCodeVim/Vim/issues/7068), so while that issue is still open, we can't remove the workaround and fix this bug.
This is exactly my problem with hsnips. This is quite annoying tbh, and this causes so much headache for my workload. But at this moment, this is still the best snippets extension I can find... hope this can be fixed in a near future.
I've noticed that if we use a $2
tabstop instead of a $0
tabstop, tabs continue to work even with expansions. The only issue is that it's difficult to "end the snippet" (see https://github.com/draivin/hsnips/issues/1) which results in continuous highlighting of text after the tab (see https://github.com/draivin/hsnips/issues/106) and requiring two "esc" keys to go into vim normal mode.
snippet mk "inline math" wA
\$$1\$ $2
endsnippet
Is there a way to end the snippet easily if we use a $2
tabstop?
I would like to bump this issue, they started disappearing for me starting last update (v0.2.9), exactly as described above. I am not using Vim or anything similar, and su-stephen's $2 workaround does not work for me either.
Edit: I have just tried downgrading to v0.2.8, and looks like they're not working on earlier versions anymore either... might be a VSCode thing.
Same here. With no vim extension still I have the issue of disappearing tab-stobs in nested snips and the $2 hack does not solve this either. Also on v0.2.9.
I also have the problem without the vim extension. Even without all extensions except hyperscopes and hypersnips the problem is still there.