刚刚更新到的最新版本,问题已经不存在了, commit 9b47533 解决了这个问题。
文件重命名的支持已经做了,可以更新尝试一下。
现在 lsp-bridge 太快了,无时无刻不在弹出补全菜单, 但在某些场景下没有必要弹出补全菜单,比如行首位置、 比如空括号内, 现在主要靠下面两个选项在控制:
(defcustom lsp-bridge-completion-stop-commands '(corfu-complete corfu-insert undo-tree-undo undo-tree-redo)
"If last command is match this option, stop popup completion ui."
:type 'cons
:group 'lsp-bridge)
(defcustom lsp-bridge-hide-completion-characters '(":" ";" "(" ")" "[" "]" "{" "}" "," "\"")
"If char before match this option, stop popup completion ui."
:type 'cons
:group 'lsp-bridge)
欢迎大家一起来补全这两条规则,如果有一些意外情况大家也可以反馈,争取把默认配置弄的舒服点,避免 lsp-bridge 到处弹补全对话框。
大佬威武!花了些时间爬楼。
现在javascript里可以多种语言混写的,例如scss跟graphql可以都在同一个文件里。vscode是支持多开不同的lsp的(eslint, graphql, ts-ls),用来补全不同的代码块
lsp-bridge 理论上是可以支持多个 server ,不同的代码块用不同的服务器,还需要进一步改造才行,慢慢来吧。现在写代码不卡手,已经很幸福啦,哈哈哈哈。
哈哈哈,对的太丝滑了。可以用json配置也非常爽,可以直接抄vscode的参数
设计的时候就想过,千万不要像 lsp-mode 那样用 elisp 配置 LSP 参数,不方便社区成员贡献(抄VSCode配置),哈哈哈哈。
最新的代码下,在写vue时,如果一个字段是可选类型的,那么会导致补全混乱。
已经修复了,请更新。
已更新!修复了!
If my colleague can be this effective in fixing bugs, life would be a lot easier lol.
请问一下对c不在同一个文件夹里对头文件补全的正确姿势是啥呀,用的json文件没有效果
添加了 For Xref support 的代码后使用 xref 跳转到定义的时候会提示
xref--show-defs: Wrong type argument: listp, #s(lsp-bridge-deferred-object identity lsp-bridge-deferred-resignal lsp-bridge-deferred-default-cancel nil nil nil)
Backtrace 显示的是
Debugger entered--Lisp error: (wrong-type-argument listp #s(lsp-bridge-deferred-object :callback identity :errorback lsp-bridge-deferred-resignal :cancel lsp-bridge-deferred-default-cancel :next nil :status nil :value nil))
xref-show-definitions-buffer(#f(compiled-function () #<bytecode -0xe20b3fc1854b535>) ((window . #<window 9 on qwe.java>) (display-action) (auto-jump)))
xref--show-defs(#f(compiled-function () #<bytecode -0xe20b3fc1854b535>) nil)
xref--find-definitions(#s(lsp-bridge-deferred-object :callback identity :errorback lsp-bridge-deferred-resignal :cancel lsp-bridge-deferred-default-cancel :next nil :status nil :value nil) nil)
xref-find-definitions(#s(lsp-bridge-deferred-object :callback identity :errorback lsp-bridge-deferred-resignal :cancel lsp-bridge-deferred-default-cancel :next nil :status nil :value nil))
funcall-interactively(xref-find-definitions #s(lsp-bridge-deferred-object :callback identity :errorback lsp-bridge-deferred-resignal :cancel lsp-bridge-deferred-default-cancel :next nil :status nil :value nil))
command-execute(xref-find-definitions)
只有我会这样吗?
好的,谢谢啦
lsp-bridge的xref功能感觉实现的不完备呀,建议直接用内置的命令来跳转和引用。
- 语法高亮:用Emacs TreeSitter 来做 现在有支持使用TreeSitter进行语法高亮的包吗?
谢谢;
tree-sitter-hl-mode
(use-package corfu
;; Optional customizations
;; :custom
;; (corfu-cycle t) ;; Enable cycling for `corfu-next/previous'
;; (corfu-auto t) ;; Enable auto completion
;; (corfu-separator ?\s) ;; Orderless field separator
;; (corfu-quit-at-boundary nil) ;; Never quit at completion boundary
;; (corfu-quit-no-match nil) ;; Never quit, even if there is no match
;; (corfu-preview-current nil) ;; Disable current candidate preview
;; (corfu-preselect-first nil) ;; Disable candidate preselection
;; (corfu-on-exact-match nil) ;; Configure handling of exact matches
;; (corfu-echo-documentation nil) ;; Disable documentation in the echo area
;; (corfu-scroll-margin 5) ;; Use scroll margin
;; Enable Corfu only for certain modes.
;; :hook ((prog-mode . corfu-mode)
;; (shell-mode . corfu-mode)
;; (eshell-mode . corfu-mode))
;; Recommended: Enable Corfu globally.
;; This is recommended since Dabbrev can be used globally (M-/).
;; See also `corfu-excluded-modes'.
:init
(global-corfu-mode)
(corfu-history-mode t)
:config
(use-package cape)
(use-package lsp-bridge
:ensure nil
:quelpa (lsp-bridge :fetcher github :repo "manateelazycat/lsp-bridge")
:hook ((after-init . lsp-bridge-mode))
:init
(require 'lsp-bridge)
(require 'lsp-bridge-jdtls)
(require 'corfu)
(require 'corfu-info)
(require 'corfu-history)
(require 'lsp-bridge-icon) ;; show icons for completion items, optional
(require 'lsp-bridge-orderless) ;; make lsp-bridge support fuzzy match, optional
(global-lsp-bridge-mode)
:config
(setq lsp-bridge-enable-log nil)
;; 让corfu适应高分屏
(when (> (frame-pixel-width) 3000) (custom-set-faces '(corfu-default ((t (:height 1.3))))))
;; 打开日志,开发者才需要
;; (setq lsp-bridge-enable-log t)
;; 默认用这三个补全后端
(add-to-list 'completion-at-point-functions #'cape-symbol)
(add-to-list 'completion-at-point-functions #'cape-file)
(add-to-list 'completion-at-point-functions #'cape-dabbrev)
(dolist (hook (list
'emacs-lisp-mode-hook
))
(add-hook hook (lambda ()
(setq-local corfu-auto t) ; Elisp文件自动弹出补全
)))
;; 通过Cape融合不同的补全后端,比如lsp-bridge、 tabnine、 file、 dabbrev.
(defun lsp-bridge-mix-multi-backends ()
(setq-local completion-category-defaults nil)
(setq-local completion-at-point-functions
(list
(cape-capf-buster
(cape-super-capf
#'lsp-bridge-capf
;; 我嫌弃TabNine太占用我的CPU了, 需要的同学注释下面这一行就好了
;; #'tabnine-completion-at-point
;; #'cape-file
;; #'cape-dabbrev
)
'equal)
)))
(dolist (hook lsp-bridge-default-mode-hooks)
(add-hook hook (lambda ()
(setq-local corfu-auto nil) ; 编程文件关闭Corfu自动补全, 由lsp-bridge来手动触发补全
(lsp-bridge-mode 1) ; 开启lsp-bridge
(lsp-bridge-mix-multi-backends) ; 通过Cape融合多个补全后端
)))
;; 融合 `lsp-bridge' `find-function' 以及 `dumb-jump' 的智能跳转
(defun lsp-bridge-jump ()
(interactive)
(cond
((eq major-mode 'emacs-lisp-mode)
(let ((symb (function-called-at-point)))
(when symb
(find-function symb))))
(lsp-bridge-mode
(lsp-bridge-find-def))
(t
(require 'dumb-jump)
(dumb-jump-go))))
(defun lsp-bridge-jump-back ()
(interactive)
(cond
(lsp-bridge-mode
(lsp-bridge-return-from-def))
(t
(require 'dumb-jump)
(dumb-jump-back))))
))
我这样配置不生效, 找到原因了,没有把python脚本安装过去 。。。
需要把python脚本单独打包好。。。
这样原始使用的方式,管理起来好麻烦。。,先切回旧的方式了