vim-vsnip icon indicating copy to clipboard operation
vim-vsnip copied to clipboard

Wrong cursor position for some snippets sometimes

Open svermeulen opened this issue 5 years ago • 7 comments

Given the following snippet:

{
  "if": {
    "prefix": ["if"],
    "body": [
      "if (${1})",
      "{",
      "\t${TM_SELECTED_TEXT}$0",
      "}"
    ]
  }
}

If this snippet is expanded, the cursor (which I will indicate as ^) sometimes ends up here if (^) (as expected) but most times it ends up here: if ()^.

I tried to reproduce this in vanilla vim with just the vsnip plugin, but it behaved correctly in this case, so it could be related to my config

I thought it might be related to the popup menu, but it doesn't seem to matter whether this is open or not

svermeulen avatar Sep 28 '20 00:09 svermeulen

My current workaround is to use this instead which doesn't have the issue:

  "if": {
    "prefix": ["if"],
    "body": [
      "if (${1: })",
      "{",
      "\t${TM_SELECTED_TEXT}$0",
      "}"
    ]
  },

svermeulen avatar Sep 28 '20 00:09 svermeulen

Hm... In my environment, the problem does not reproduce...

Could you try to detect dependent plugin or tell the list of all plugins?

In this case, vsnip invoke s:Session.move but its very simple... https://github.com/hrsh7th/vim-vsnip/blob/master/autoload/vsnip/session.vim#L177

hrsh7th avatar Sep 28 '20 03:09 hrsh7th

Ok I'll try narrowing it down some more by slowly removing plugins

svermeulen avatar Sep 28 '20 03:09 svermeulen

Could you test with latest vsnip?

hrsh7th avatar Nov 14 '20 05:11 hrsh7th

Ok this appears to be fixed now. I reproduced it quite easily before updating but afterwards I can't reproduce it again. Thanks!

svermeulen avatar Nov 14 '20 18:11 svermeulen

False alarm :| I'm seeing it again despite being up to date

svermeulen avatar Nov 15 '20 08:11 svermeulen

Thank you. Hm... it',very weird.

hrsh7th avatar Nov 15 '20 08:11 hrsh7th