Skip to content

Commit

Permalink
lsp-bridge-disable-electric-indent option should remove, save-restric…
Browse files Browse the repository at this point in the history
…tion fix issue.
  • Loading branch information
manateelazycat committed Jan 4, 2025
1 parent bd4e8e6 commit cdf31de
Showing 1 changed file with 0 additions and 25 deletions.
25 changes: 0 additions & 25 deletions lsp-bridge.el
Original file line number Diff line number Diff line change
Expand Up @@ -2425,17 +2425,6 @@ Default is `bottom-right', you can choose other value: `top-left', `top-right',

(add-hook 'post-command-hook #'lsp-bridge-start-process)

(when lsp-bridge-disable-electric-indent
;; NOTE:
;; Don't enable `electric-indent-mode' in lsp-bridge, `electric-indent-post-self-insert-function'
;;
;; It will try adjust line indentation *AFTER* user insert character,
;; this additional indent action send excessive `change_file' request to lsp server.
;; LSP server will confused those indent action and return wrong completion candidates.
;;
;; Example, when you enable `electric-indent-mode', when you type `std::', you will got wrong completion candidates from LSP server.
(electric-indent-local-mode -1))

;; Don't enable lsp-bridge when current buffer is acm buffer.
(unless (or (equal (buffer-name (current-buffer)) acm-buffer)
(equal (buffer-name (current-buffer)) acm-doc-buffer))
Expand Down Expand Up @@ -3054,20 +3043,6 @@ then BODY is executed within that buffer."
(lsp-bridge-call-async "message_hostnames"))


(defcustom lsp-bridge-disable-electric-indent t
"`electric-indent-post-self-insert-function' will cause return wrong completion candidates from LSP server, such as type `std::' in C++.
Please turn this option on if you want fix `std::' completion candidates, at same time, `electric-indent-mode' will disable by lsp-bridge.
Please keep this option off if you need `electric-indent-mode' feature more.
It's a bug of `electric-indent-mode' that it will try adjust line indentation *AFTER* user insert character,
this additional indent action send excessive `change_file' request to lsp server.
LSP server will confused those indent action and return wrong completion candidates.
I haven't idea how to make lsp-bridge works with `electric-indent-mode', PR are welcome.")


(defun lsp-bridge-sync-tramp-remote (force)
(interactive)
(let* ((file-name (lsp-bridge-get-buffer-file-name-text))
Expand Down

0 comments on commit cdf31de

Please sign in to comment.