lsp-bridge -- 速度最快的语法补全插件

意见代码已经修改好了,tabnine-bridge-send-request这个逻辑是参考tabnine-capf的,具体是不是同步不太能看懂,实际体验下来只有刚输入创建tabnine process的时候会卡一下,后面就不会了

能否提前把进程建好?比如启动lsp-bridge的时候,如果用户打开tabnine就创建进程?

应该是可以的,不过每次请求的时候还是会判断下进程是否存在,我先本地试试

又提了两个小意见,还需要再改进一下,感谢! :wink:

可以用我写的插件 find-orphan/README.md at c8ecdd52fee60285276d835e3bc78eec292ecf88 · manateelazycat/find-orphan · GitHub

快速检查一下 tabnine-bridge.el 是否还有多于函数。 :wink:

好的,我试试 :grinning:

遇到个神奇的问题,我把if acm-enable-tabnine-helper 下面的(debug)去掉后就一直不走tabnine的逻辑了,我本地配置(setq acm-enable-tabnine-helper t)也写了,然后我在之前debug eval这个值还是nil。更神奇的是之前有这个debug的代码,我本地没有走断点,直接可以展示tabnine的补全项。这种该怎么调试啊。

debug那一行没去之前,你其实执行的是else分支,去掉以后不执行,就证明if条件不是true

这种简单的直接message print就可以调试。

打印起来确实是nil,那在配置文件中写了(setq acm-enable-tabnine-helper t)这个为什么没有生效呢,我在setq之后打印是t

知道原因了,这个变量我参考另一个helper用的defvar-local,改成 defcustom 就好了

local变量要用 setq-local

嗯嗯,之前学习过的,没想到

还有几个小细节,稍微完善一下, 这个补丁就可以合并了, 补丁质量很高, 大佬辛苦啦! :wink:

嗯嗯,修改已经提交了,感谢大佬的code review,学习到了一些小细节 :grinning:

代码已经合并了,辛苦啦。

TabNine 本身是支持括号自动平衡的, 我添加了一个新的补丁 Replace old suffix with new suffix for candidate to auto balance brac… · manateelazycat/lsp-bridge@960c63c · GitHub

现在可以自动插入不平衡的括号了。

更新后报错了 typescript-mode

--- Recv message (error):
{
   "jsonrpc": "2.0",
   "id": 10512,
   "error": {
      "code": -32603,
      "message": "Request textDocument/completion failed with message: Error processing request. Debug Failure. False expression.\nError: Debug Failure. False expression.\n    at checkChangeRange (/Volumes/D/shide/vue-mobile-app/node_modules/typescript/lib/tsserver.js:38559:26)\n    at Object.updateSourceFile (/Volumes/D/shide/vue-mobile-app/node_modules/typescript/lib/tsserver.js:38149:13)\n    at Object.updateSourceFile (/Volumes/D/shide/vue-mobile-app/node_modules/typescript/lib/tsserver.js:31160:47)\n    at Object.updateLanguageServiceSourceFile (/Volumes/D/shide/vue-mobile-app/node_modules/typescript/lib/tsserver.js:164223:40)\n    at acquireOrUpdateDocument (/Volumes/D/shide/vue-mobile-app/node_modules/typescript/lib/tsserver.js:135489:43)\n    at Object.updateDocumentWithKey (/Volumes/D/shide/vue-mobile-app/node_modules/typescript/lib/tsserver.js:135423:20)\n    at Object.getOrCreateSourceFileByPath [as getSourceFileByPath] (/Volumes/D/shide/vue-mobile-app/node_modules/typescript/lib/tsserver.js:164588:53)\n    at tryReuseStructureFromOldProgram (/Volumes/D/shide/vue-mobile-app/node_modules/typescript/lib/tsserver.js:117055:28)\n    at Object.createProgram (/Volumes/D/shide/vue-mobile-app/node_modules/typescript/lib/tsserver.js:116531:29)\n    at synchronizeHostData (/Volumes/D/shide/vue-mobile-app/node_modules/typescript/lib/tsserver.js:164475:26)\n    at Object.getProgram (/Volumes/D/shide/vue-mobile-app/node_modules/typescript/lib/tsserver.js:164607:13)\n    at ConfiguredProject.Project.updateGraphWorker (/Volumes/D/shide/vue-mobile-app/node_modules/typescript/lib/tsserver.js:169675:53)\n    at ConfiguredProject.Project.updateGraph (/Volumes/D/shide/vue-mobile-app/node_modules/typescript/lib/tsserver.js:169603:42)\n    at ConfiguredProject.updateGraph (/Volumes/D/shide/vue-mobile-app/node_modules/typescript/lib/tsserver.js:170717:63)\n    at Object.updateProjectIfDirty (/Volumes/D/shide/vue-mobile-app/node_modules/typescript/lib/tsserver.js:171206:45)\n    at ConfiguredProject.Project.getLanguageService (/Volumes/D/shide/vue-mobile-app/node_modules/typescript/lib/tsserver.js:169212:28)\n    at IOSession.Session.getCompletions (/Volumes/D/shide/vue-mobile-app/node_modules/typescript/lib/tsserver.js:176463:43)\n    at Session.handlers.ts.Map.ts.getEntries._a.<computed> (/Volumes/D/shide/vue-mobile-app/node_modules/typescript/lib/tsserver.js:175138:61)\n    at /Volumes/D/shide/vue-mobile-app/node_modules/typescript/lib/tsserver.js:177195:88\n    at IOSession.Session.executeWithRequestId (/Volumes/D/shide/vue-mobile-app/node_modules/typescript/lib/tsserver.js:177186:28)\n    at IOSession.Session.executeCommand (/Volumes/D/shide/vue-mobile-app/node_modules/typescript/lib/tsserver.js:177195:33)\n    at IOSession.Session.onMessage (/Volumes/D/shide/vue-mobile-app/node_modules/typescript/lib/tsserver.js:177221:35)\n    at Interface.<anonymous> (/Volumes/D/shide/vue-mobile-app/node_modules/typescript/lib/tsserver.js:179826:31)\n    at Interface.emit (node:events:390:28)\n    at Interface._onLine (node:readline:487:10)\n    at Interface._normalWrite (node:readline:661:12)\n    at Socket.ondata (node:readline:269:10)\n    at Socket.emit (node:events:390:28)\n    at addChunk (node:internal/streams/readable:315:12)\n    at readableAddChunk (node:internal/streams/readable:289:9)\n    at Socket.Readable.push (node:internal/streams/readable:228:10)\n    at Pipe.onStreamRead (node:internal/stream_base_commons:199:23)"
   }
}

嗯嗯,辛苦大佬了 :grinning:

这个是开了tabnine后报的还是没开啊

在不开启lsp-tabnine之前,并且还没有执行tabnine-bridge-install-binary

tabnine-bridge-install-binary之后就没有问题了,我本机之前是有使用tabnine的,所以有下载tabnine,估计也许tabnine可执行文件目录地址不同.

目前没有报错在tabnine-bridge-install-binary之后