The Wayback Machine - https://web.archive.org/web/20220709051804/https://github.com/SirVer/ultisnips/issues/1168
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

Ignore Preview Content #1168

Open
aoswalt opened this issue Jan 24, 2020 · 3 comments
Open

Ignore Preview Content #1168

aoswalt opened this issue Jan 24, 2020 · 3 comments
Labels

Comments

@aoswalt
Copy link

@aoswalt aoswalt commented Jan 24, 2020

Expected behavior:

When opening a preview with pedit (such as with running a database command with vim-dadbod), it should not have an effect on snippets.

Actual behavior:

Depending on the output, vim can freeze until the python process is killed, which seems to be the same as #155.

Steps to reproduce

  1. Stop early in a multi-step snippet. In the following snippet, a valid sql statement will exist at the first step.
snippet sel "select (columns:*) from table"
select ${2:*} from ${1} $0
endsnippet
  1. Execute statement with dadbod's :DB, which opens a preview window with the result.
  2. Navigate to preview window.

Some larger outputs cause the python process to hang and never complete.

Thoughts

I imagine 2 separate ways to solve my issue:

  1. Have UltiSnips ignore preview text (No idea how feasible this is)
  2. Provide a function that aborts a snippet. This should be able to provide a solution #1017 and mine through an autocommand.

  • Operating System: Mac OS 10.14.6
  • Vim Version: NVIM v0.4.3, Build type: Release
  • UltiSnips Version: 3.2
  • Python inside Vim: 2.7.17 / 3.8.1
  • Docker repo/vimrc: My Full VimRC
@aoswalt
Copy link
Author

@aoswalt aoswalt commented Jan 24, 2020

Here is a sample of database output that causes the issue.

https://gist.github.com/aoswalt/73ce82cf3ce84ebc6caf0508f3333c9a

Instead of executing with :DB, :pedit that file and navigate to it.

@SirVer
Copy link
Owner

@SirVer SirVer commented Jan 25, 2020

See #681 and #586 for similar issues, especially #586 (comment).

When opening a preview with pedit (such as with running a database command with vim-dadbod), it should not have an effect on snippets.

I disagree with this. pedit leaves the current buffer and should hence terminate all currently in-flux snippets.

It apparently does not do this here, leading to laggy UI. My hunch here is that dadbot's DB is suppressing AutoCommands and hence does not trigger the BufLeave autocommand (though it totally leaves the buffer) and that confuses UltiSnips.

There are multiple avenues to a fix here:

  • DB should be changed to properly send BufLeave Autocommand.
  • UltiSnips could actually be changed to figure out that the buffer is a different than the last time it's cursor was moved though, so this could be added as a fix.
@SirVer SirVer added bug: low good first issue triaged labels Jan 25, 2020
@aoswalt
Copy link
Author

@aoswalt aoswalt commented Jan 27, 2020

With some more testing, I realize that I conflated the circumstances around the issue.

The freezing only happens when navigating to the preview window. DB is only calling pedit, and I can replicate it with only a raw pedit. The navigation seems to be more the culprit than the pedit itself, even though it does not happen with a standard split.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2 participants