Last active
October 24, 2018 14:16
-
-
Save twlz0ne/bfdf29909db5baec24fd4e9ad622adc2 to your computer and use it in GitHub Desktop.
Reproduce issue that eglot hangs with message "[jsonrpc] (warning) Sentinel for EGLOT (~/c-mode) still hasn't run, deleting it!" #Emacs #LSP
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ;;; tset-eglot.el --- Test eglot -*- lexical-binding: t; -*- | |
| ;;; Date: 2018-09-11_11.46.58 | |
| ;;; Commentary: | |
| ;; | |
| ;; Reproduce issue that eglot hangs with message "[jsonrpc] (warning) Sentinel for EGLOT (~/c-mode) still hasn't run, deleting it!" | |
| ;; | |
| ;;; Steps: | |
| ;; | |
| ;; ⋊> which cquery | |
| ;; /usr/local/bin/cquery | |
| ;; ⋊> /path/to/emacs -nw -Q -l /path/to/test-eglot.el | |
| ;; [jsonrpc] (warning) Sentinel for EGLOT (test-eglot--azRNDS/c-mode) still hasn't run, deleting it! | |
| ;; `C-g C-g' | |
| ;; Job 1, 'emacs -nw -Q -l ~/.scratch/emac…' has stopped | |
| ;; | |
| ;;; Code: | |
| (toggle-debug-on-error) | |
| (global-set-key (kbd "C-h") 'delete-backward-char) | |
| (global-set-key (kbd "M-h") 'backward-kill-word) | |
| (global-set-key (kbd "<f1>") 'help-command) | |
| (define-key isearch-mode-map "\C-h" 'isearch-delete-char) | |
| ;; ------------------------------------------------------------------ | |
| (setq user-emacs-directory (format "~/.emacs.d/%s/%s/" (file-name-base load-file-name) emacs-version)) | |
| (setq package-user-dir (concat user-emacs-directory "elpa/")) | |
| (unless (load "~/.emacs.d/elpa.el" t) | |
| (setq package-archives | |
| '(("gnu" . "https://elpa.gnu.org/packages/") | |
| ("melpa" . "https://melpa.org/packages/")))) | |
| (package-initialize) | |
| (defun require-packages (&rest packages) | |
| (dolist (pkg packages) | |
| (unless (package-installed-p pkg) | |
| (package-refresh-contents) | |
| (package-install pkg)) | |
| (require pkg))) | |
| ;; ------------------------------------------------------------------ | |
| (require-packages | |
| 'eglot) | |
| (defun make-test-file () | |
| (let* ((tmpdir (make-temp-file "test-eglot--" 'tmpdir "/")) | |
| (test-file (concat tmpdir "main.c"))) | |
| (with-temp-buffer | |
| (insert | |
| (format | |
| "/* main.c generated at %s. */" | |
| (format-time-string "%Y-%m-%d %H:%M"))) | |
| (write-region (point-min) (point-max) test-file)) | |
| test-file)) | |
| (add-hook 'c-mode-hook 'eglot-ensure) | |
| (add-hook 'after-init-hook | |
| (lambda () | |
| (find-file (make-test-file)) | |
| )) | |
| (run-hooks 'after-init-hook) | |
| ;;; test-eglot.el ends here |
The issue caused by ccls(default), it disappeared after adding the following code:
(add-hook 'after-init-hook
(lambda ()
+ (add-to-list 'eglot-server-programs '((c++ mode c-mode) . (eglot-cquery "cquery")))
(find-file (make-test-file))
))
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Environment
macOS: 10.11.6
Emacs: 27.0.50
Cquery: stable 20180718, HEAD
Packages: eglot-20180908.2219, jsonrpc-1.0.6