lsp-mode icon indicating copy to clipboard operation
lsp-mode copied to clipboard

Capabilites not displayed when using plists

Open fredericgiquel opened this issue 2 years ago • 2 comments

Thank you for the bug report

  • [X] I am using the latest version of lsp-mode related packages.
  • [X] I checked FAQ and Troubleshooting sections
  • [X] You may also try reproduce the issue using clean environment using the following command: M-x lsp-start-plain

Bug description

Without using plists, capabilites of language server are displayed when pressing associated button in "lsp-describe-session" buffer.

When using plists, nothing appens as we can see in this video :

https://user-images.githubusercontent.com/17704127/166008003-4a399a5a-eff4-4f63-b03d-c8a86ad39600.mp4

Steps to reproduce

  • Use the following "init.el" minimal configuration:
;; Initialize package sources
(require 'package)

(setq package-archives '(("melpa" . "https://melpa.org/packages/")
                         ("elpa" . "https://elpa.gnu.org/packages/")))

(package-initialize)
(unless package-archive-contents
  (package-refresh-contents))

(unless (package-installed-p 'use-package)
  (package-install 'use-package))

(require 'use-package)
(setq use-package-always-ensure t)

(use-package lsp-mode
  :init
  (setq read-process-output-max (* 1024 1024))
  (setq gc-cons-threshold 100000000))
  • Activate plists support as describe here: https://emacs-lsp.github.io/lsp-mode/page/performance/#use-plists-for-deserialization
  • Launch "lsp" then "lsp-describe-session"
  • Activate the "capabilities" button

Expected behavior

Capabilities displayed as without plists.

Which Language Server did you use?

pylsp but the problem is the same with others language servers

OS

Linux

Error callstack

No response

Anything else?

No response

fredericgiquel avatar Apr 29 '22 19:04 fredericgiquel

I also have this problem. I'm on macOS 12.4. I have the following in my .bash_profiile:

export LSP_USE_PLISTS=true

with the following lsp-mode setup (via use-package):

(use-package lsp-mode
  :commands (lsp lsp-deferred)
  :bind (:map lsp-mode-map ("C-c l M-." . #'lsp-find-references))
  :init
  ;; set prefix for lsp-command-keymap (few alternatives - "C-l", "C-c l")
  (setq lsp-keymap-prefix "C-c l"
        lsp-session-file (concat user-cache-dir "lsp.cache")
        lsp-server-install-dir (concat user-cache-dir "lsp-servers"))
  :config
  (setq lsp-use-plists t
        read-process-output-max (* 1024 1024) ;; 1MB
        lsp-log-io nil ;; if set to true can cause a performance hit
        ;; auto restart LSP
        lsp-restart 'auto-restart
        lsp-signature-render-documentation t
        ;; header-line path
        lsp-headerline-breadcrumb-enable t
        ;; header-line icons
        lsp-headerline-breadcrumb-icons-enable nil
        ;; Sideline code actions
        lsp-ui-sideline-enable nil
        ;; modeline code actions
        lsp-modeline-code-actions-enable nil
        ;; turn off flymake
        ;;(setq lsp-diagnostics-provider :none)
        ;; modeline diags (doom-modeline already provides this)
        lsp-modeline-diagnostics-enable nil
        ;; lsp builtin auto-fill
        lsp-enable-on-type-formatting nil
        ;; completion
        lsp-completion-enable nil
        lsp-completion-provider :none
        ;; disable indentation
        lsp-enable-indentation nil
        ;;(setq lsp-completion-show-detail nil)
        ;;(setq lsp-completion-show-kind nil)
        lsp-idle-delay 0.5)
  ;;(setq lsp-semantic-tokens-mode t)
  ;;(setq lsp-semantic-tokens-apply-modifiers t)
  ;;(setq lsp-semantic-tokens-warn-on-missing-face t)
  (setq lsp-clients-clangd-args
        `("--header-insertion=never"
          "--header-insertion-decorators"
          ,(format "-j=%d" (max 1 (/ (jf/numcores) 2)))
          "--cross-file-rename"
          "--background-index"
          "--recovery-ast"
          "--all-scopes-completion"
          "--enable-config"
          "--clang-tidy"
          "--inlay-hints"))
  (lsp-register-client
   (make-lsp-client :new-connection (lsp-tramp-connection
                                     '("clangd"
                                       "--header-insertion=never"
                                       "--header-insertion-decorators"
                                       "-j=5"
                                       "--background-index"
                                       "--all-scopes-completion"
                                       "--clang-tidy"))
                    :activation-fn (lsp-activate-on "c" "cpp" "objective-c")
                    :remote? t
                    :priority -1
                    :server-id 'clangd
                    :library-folders-fn (lambda (_workspace) lsp-clients-clangd-library-directories)))
  :hook
  (;; replace XXX-mode with concrete major-mode(e. g. python-mode)
   (c-mode   . lsp-deferred)
   (c++-mode . lsp-deferred)
   (cc-mode  . lsp-deferred)
   ;;(python-mode . lsp)
   ;;(sh-mode . lsp)
   ;; if you want which-key integration
   (lsp-mode . lsp-enable-which-key-integration)))

Jacobfaib avatar Jun 27 '22 14:06 Jacobfaib

Try setting (setenv "LSP_USE_PLISTS" "1") in your init.el before lsp-mode is loaded. Found this in a post of doom emacs discourse.

innerout avatar Jul 03 '22 12:07 innerout

Fixed in https://github.com/emacs-lsp/lsp-mode/pull/3669

yyoncho avatar Aug 11 '22 16:08 yyoncho