Skip to content

Commit

Permalink
Resolve compilation warnings
Browse files Browse the repository at this point in the history
* eglot.el (company-tooltip-align-annotations): Forward declare.
(eglot--cached-server): Renamed from eglot--cached-current-server.
(eglot--managed-mode, eglot-current-server)
(eglot--current-server-or-lose)
(eglot--maybe-activate-editing-mode): use it.
(eglot-completion-at-point): Don't use insertTextFormat.
  • Loading branch information
joaotavora committed Nov 20, 2019
1 parent 73d3774 commit a6fa773
Showing 1 changed file with 13 additions and 12 deletions.
25 changes: 13 additions & 12 deletions eglot.el
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,8 @@
(require 'filenotify)
(require 'ert)
(require 'array)
(defvar company-backends) ; forward-declare, but don't require company yet
(defvar company-backends) ; forward-declare, but don't require company
(defvar company-tooltip-align-annotations)



Expand Down Expand Up @@ -1222,6 +1223,9 @@ For example, to keep your Company customization use
(push (cons ',symbol (symbol-value ',symbol)) eglot--saved-bindings)
(setq-local ,symbol ,binding)))

(defvar-local eglot--cached-server nil
"A cached reference to the current EGLOT server.")

(define-minor-mode eglot--managed-mode
"Mode for source buffers managed by some EGLOT project."
nil nil eglot-mode-map
Expand Down Expand Up @@ -1251,7 +1255,7 @@ For example, to keep your Company customization use
#'eglot-imenu))
(flymake-mode 1)
(eldoc-mode 1)
(cl-pushnew (current-buffer) (eglot--managed-buffers eglot--cached-current-server)))
(cl-pushnew (current-buffer) (eglot--managed-buffers eglot--cached-server)))
(t
(remove-hook 'after-change-functions 'eglot--after-change t)
(remove-hook 'before-change-functions 'eglot--before-change t)
Expand All @@ -1270,8 +1274,8 @@ For example, to keep your Company customization use
do (set (make-local-variable var) saved-binding))
(remove-function (local 'imenu-create-index-function) #'eglot-imenu)
(setq eglot--current-flymake-report-fn nil)
(let ((server eglot--cached-current-server))
(setq eglot--cached-current-server nil)
(let ((server eglot--cached-server))
(setq eglot--cached-server nil)
(when server
(setf (eglot--managed-buffers server)
(delq (current-buffer) (eglot--managed-buffers server)))
Expand All @@ -1284,16 +1288,13 @@ For example, to keep your Company customization use
"Turn off `eglot--managed-mode' unconditionally."
(eglot--managed-mode -1))

(defvar-local eglot--cached-current-server nil
"A cached reference to the current EGLOT server.")

(defun eglot-current-server ()
"Return logical EGLOT server for current buffer, nil if none."
eglot--cached-current-server)
eglot--cached-server)

(defun eglot--current-server-or-lose ()
"Return current logical EGLOT server connection or error."
(or eglot--cached-current-server
(or eglot--cached-server
(jsonrpc-error "No current JSON-RPC connection")))

(defvar-local eglot--unreported-diagnostics nil
Expand All @@ -1313,8 +1314,8 @@ If it is activated, also signal textDocument/didOpen."
;; `revert-buffer-preserve-modes' is nil.
(when (and buffer-file-name
(or
eglot--cached-current-server
(setq eglot--cached-current-server
eglot--cached-server
(setq eglot--cached-server
(cl-find major-mode
(gethash (or (project-current)
`(transient . ,default-directory))
Expand Down Expand Up @@ -2026,7 +2027,7 @@ is not active."
(funcall proxies)))))
:annotation-function
(lambda (proxy)
(eglot--dbind ((CompletionItem) detail kind insertTextFormat)
(eglot--dbind ((CompletionItem) detail kind)
(get-text-property 0 'eglot--lsp-item proxy)
(let* ((detail (and (stringp detail)
(not (string= detail ""))
Expand Down

0 comments on commit a6fa773

Please sign in to comment.