Skip to content
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

Does not expand automatic snippets when typing too fast #1484

Open
JoachimFavre opened this issue Aug 28, 2022 · 1 comment
Open

Does not expand automatic snippets when typing too fast #1484

JoachimFavre opened this issue Aug 28, 2022 · 1 comment

Comments

@JoachimFavre
Copy link

When typing too fast, some snippets which should expand automatically do not.

Expected behavior:
Have all automatic snippets expanded.

Actual behavior:
Some snippets are not expanded.

Steps to reproduce

  1. Use the following snippet for .tex files:
snippet ( "" iA
\left( 
endsnippet
  1. Keep the key "(" pressed.
  2. After some time, we start seeing things like "\left( (\left( ", whereas it should be "\left( \left( \left( ".

Note that you might need to have a rather long line before starting seeing the problem.

More information:
I found that when the line I am writing is very small, this problem does not occur often, but the longer the line the more I see it. I have also noticed that the size of the document I am writing and the number of my snippets are other factors which make this problem worse. Also. strangely enough, it also depends on the file extension: the problem needs a much shorter line to appear in a .tex file than in a .txt one (maybe because of syntax colouring?).

All this makes me think that UltiSnips takes too much time to process a key press, and then, when it looks at what was typed since the last update, it skips (voluntarily or not) some key presses. I don't really care if what is on my screen is not exactly up to date with everything I type, as long as, in the end, all text is here and all my snippets are expanded correctly (especially for the ones which should be automatically expanded).

I think that a key buffer could solve my problem. It didn't feel so when I browsed on the internet and through the documentation, but could there be an option in UltiSnips which I am missing? I also think that, if this behaviour is expected (as a tradeoff for speed), I could maybe use a Vim plugin or an external application which would record all my keypresses in a buffer, and give them to UltiSnips or Vim with a minimum time between two key presses; would you have an idea of a tool which could do that (and do you think it could work)?

Note that this post mirrors a question I asked on the Vim StackExchange, following an advice from Vivian De Smedt.


  • Operating System: Windows 10
  • Vim Version:
    VIM - Vi IMproved 8.2 (2019 Dec 12, compiled May 2 2021 19:00:02)
    MS-Windows 32-bit GUI version with OLE support
  • UltiSnips Version: 4f5249b
  • Python inside Vim: 3.6.8
  • VimRC:
call plug#begin('~/.vim/plugged')
Plug 'sirver/ultisnips'
call plug#end()
@tinkerfond
Copy link

I have the same issue when using ultisnips for .tex files.

OS: Ubuntu 18.04 bionic
Kernel: x86_64 Linux 4.15.0-206-generic
Vim Version: NVIM v0.6.1
Python: 3.6.9

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants