Microsoft 主持开发的主流语言通用补全后端。
哈哈,其实这个不是很难写,不过目前功能很有限就是了
5 个赞
哈哈,作者现身了
company-capf只有在你的buffer里指定了completion-at-point-functions的时候有用。一般是需要major mode实现或者由像lsp-mode这样的第三方包来实现。
我一般这样在我想要的mode里启用company-capf:
(add-hook 'java-mode-hook
(lambda ()
(set (make-variable-buffer-local 'company-backends)
'(company-capf))))
关键就是设置company-backends
,这个变量指定了company的补全后端使用什么。
哦,completion-at-point-functions
只有(tags-completion-at-point-function)
,怪不得我用company-capf
没补全
如果那个 PR 已经没有意义了,建议关闭并删除相关分支
我也有过这种经历,我发 issue 表示有意汉化某项目,结果被无视了。
今天试了下,company-lsp
结合yasnippet
很好用,Python, Go, Java 中都能实现completion-at-point
功能。
你这是什么gtk theme
這是 macOS
不好意思,孤陋寡闻了…
lsp-mode
还是不成熟不稳定,用了几天放弃了。等段时间再看吧
java的话,可以做语义跳转么,不知道你之前用过java的哪些mode?这个lsp-mode会考虑项目管理么
能用于c++补全吗?
可以,配合cquery。
你说的cquery是什么?
比起我现在用的company-clang来补全, lsp + cquery 会更好吗?
cquery 裏 #i
(#include
)
顯示效果正常
但是按回車確認補全項時輸出 #include <aio.h>include <aio.h>
。不知道是誰的鍋
read /home/maskray/Dev/Util/cquery/build/release/bin/cquery
{"jsonrpc":"2.0","method":"textDocument/completion","params":{"textDocument":{"uri":"file:///tmp/c/a.cc"},"position":{"line":0,"character":2}},"id":789}
write /home/maskray/Dev/Util/cquery/build/release/bin/cquery
{"jsonrpc":"2.0","id":789,"result":{"isIncomplete":true,"items":[{"label":"#include <aio.h>","kind":9,"detail":"aio.h","documentation":"","sortText":"","insertText":"","insertTextFor
mat":1,"textEdit":{"range":{"start":{"line":0,"character":0},"end":{"line":0,"character":2}},"newText":"#include <aio.h>"}},{"label":"#include <algorithm>","kind":9,"detail":"algorit
hm","documentation":"","sortText":"","insertText":"","insertTextFormat":1,"textEdit":{"range":{"start":{"line":0,"character":0},"end":{"line":0,"character":2}},"newText":"#include <algorithm>"}},{"label":"#include <any>","kind":9,"detail":"any","documentation":"","sortText":"","insertText":"","insertTextFormat":1,"textEdit":{"range":{"start":{"line":0,"character":0},"end":{"line":0,"character":2}},"newText":"#include <any>"}},{"label":"#include <arpa/inet.h>","kind":9,"detail":"arpa/inet.h","documentation":"","sortText":"","insertText":"","
insertTextFormat":1,"textEdit":{"range":{"start":{"line":0,"char