uga-rosa / denippet.vim

A snippet plugin for Vim/Neovim, powered by TypeScript
MIT License
30 stars 1 forks source link

なぜかTextChangedIが呼ばれる #14

Closed uga-rosa closed 10 months ago

uga-rosa commented 10 months ago

session.update()中にTextChangedIが呼ばれるっぽい。 そのせいでpumが壊れる。

最小構成

Shougo commented 10 months ago

I think pum#entered() check is needed.

diff --git a/denops/denippet/snippet.ts b/denops/denippet/snippet.ts
index 480541f..1d7bced 100644
--- a/denops/denippet/snippet.ts
+++ b/denops/denippet/snippet.ts
@@ -1,4 +1,4 @@
-import { Denops, op } from "./deps/denops.ts";
+import { Denops, op, fn } from "./deps/denops.ts";
 import { lsputil } from "./deps/lsp.ts";
 import { is } from "./deps/unknownutil.ts";
 import * as Node from "./node.ts";
@@ -87,6 +87,9 @@ export class Snippet {
   }

   async update(tabstop?: number): Promise<void> {
+    if (await fn.exists(this.denops, "*pum#entered") && await this.denops.call("pum#entered")) {
+      return;
+    }
     await this.currentNode().updateInput();
     const eventignore = await op.eventignore.get(this.denops);
     await op.eventignore.set(this.denops, "all");
uga-rosa commented 10 months ago

We found it difficult to control this on Pum side, so we had to put in a check using pum#enteredon Denippet side. Thx @Shougo !

Shougo commented 10 months ago

I have tested with eventignore, but it does not work...

Shougo commented 10 months ago

It cannot be fixed from pum.vim side. it is limitation.