-
Notifications
You must be signed in to change notification settings - Fork 8
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
Block for a long time on completion #12
Comments
I got a similar error as well. Am using this fork with it rebased on the 29.1 release commit.
And my relevent configs (use-package lsp-mode
:straight (lsp-mode
:type git
:host github
:repo "emacs-lsp/lsp-mode"
:pin "266945b3e470212305812581d24a938a96c47a3a")
:init
;; set prefix for lsp-command-keymap (few alternatives - "C-l", "C-c l")
(setq lsp-keymap-prefix "C-c l")
(setq lsp-completion-provider :none) ;; we use Corfu!
;; config fn to be run as hook taken from corfu wiki
(defun my/lsp-mode-setup-completion ()
(setf (alist-get 'styles (alist-get 'lsp-capf
completion-category-defaults))
'(orderless))) ;; Configure orderless
:commands (lsp lsp-deferred)
:hook (lsp-mode . lsp-enable-which-key-integration)
:hook (lsp-completion-mode . my/lsp-mode-setup-completion)
:config
(setq lsp-headerline-breadcrumb-enable nil)
;; increase read process max
;; as suggested in LSP performance docs
;; https://emacs-lsp.github.io/lsp-mode/page/performance/
(setq read-process-output-max (* 1024 1024)) ;; 1mb
;; making lsp work in org-babel
;; taken from https://tecosaur.github.io/emacs-config/config.html#lsp-support-src
(cl-defmacro lsp-org-babel-enable (lang)
"Support LANG in org source code block."
(cl-check-type lang stringp)
(let* ((edit-pre (intern (format "org-babel-edit-prep:%s" lang)))
(intern-pre (intern (format "lsp--%s" (symbol-name edit-pre)))))
`(progn
(defun ,intern-pre (info)
(let ((file-name (->> info caddr (alist-get :file))))
(unless file-name
(setq file-name (make-temp-file "babel-lsp-")))
(setq buffer-file-name file-name)
(lsp-deferred)))
(put ',intern-pre 'function-documentation
(format "Enable lsp-mode in the buffer of org source block (%s)."
(upcase ,lang)))
(if (fboundp ',edit-pre)
(advice-add ',edit-pre :after ',intern-pre)
(progn
(defun ,edit-pre (info)
(,intern-pre info))
(put ',edit-pre 'function-documentation
(format "Prepare local buffer environment for org source block (%s)."
(upcase ,lang))))))))
(defvar org-babel-lang-list
'("go" "python" "ipython" "bash" "sh"))
(dolist (lang org-babel-lang-list)
(eval `(lsp-org-babel-enable ,lang))))
(use-package lsp-pyright
:straight t
:hook (python-mode . (lambda ()
(require 'lsp-pyright)
(lsp-deferred))))
(use-package corfu
:straight t
:init
;; these must be set before loading corfu
;; alot of these were stolen from the proposed doom module
(setq corfu-auto t
corfu-auto-delay 0.15
corfu-auto-prefix 2
corfu-excluded-modes '(erc-mode
circe-mode
help-mode
gud-mode
vterm-mode))
;; then enable corfu globally since I will use it a bunch
(global-corfu-mode)
:config
(setq corfu-cycle t
corfu-separator ?\s
corfu-preselect t
corfu-count 16
corfu-max-width 120
corfu-preview-current 'insert
corfu-on-exact-match nil
corfu-quit-at-boundary 'separator
corfu-quit-no-match 'separator)
;; taken from doom
;; making sure when I push enter will actually insert current selection
(with-eval-after-load 'evil-collection-corfu
(evil-collection-define-key 'insert 'corfu-map
(kbd "RET") #'corfu-insert
[return] #'corfu-insert)))
|
@egstatsml Hi can you try the mentioned PR? emacs-lsp/lsp-mode#4262 |
Yep I will give it a go, might need a day or two though (It shouldn't take long just busy for the next day at least). |
Sorry for the super late response, definitely took me more than couple days just because of life. It looks like this fix is working for me, but I saw your emacs-lsp-booster package, and that seems like a better fix for now. Thanks for your work on this PR and the booster package as well, I and I'm sure many others greatly appreciate it :) |
Hello,
I compiled this
json-rpc
branch and tried it with lsp-mode (commit cb2b565b4e9b38be1f4c284e7618160383ad665d), but I found that emacs would randomly block for a long time on completion. Specifically, sometimes when I type "xxx.", the dot "." would not appear and emacs would block for about 10 seconds, then after that the dot and the completion popup would show.I'm using the typescript language server (ts-ls).
This is the stacktrace when I press "C-g" during the blocking period:
The text was updated successfully, but these errors were encountered: