Fork me on GitHub

So, I’ve been trying to use lsp for a few weeks now. My main struggle with it - the speed. For a bunch of reasons connecting to a lsp server would make things laggy. Sometimes it would be just a bit slow, at times it would be totally awful. After a bunch of different attempts I was able to make it somewhat manageable. Here are my suggestions: - Use latest Emacs version >= 27, with jansson support - Try tweaking gc-cons-threshold - Follow tips listed in - Try to minimize things, if you’re using Spacemacs, avoid official lsp layer (it includes too much stuff) - Don’t use lsp-ui - Disable everything you don’t need, here are my values:

(setq lsp-eldoc-enable-hover nil
          company-lsp-cache-candidates 'auto
          lsp-after-open-hook nil
          company-lsp-enable-snippet nil
          lsp-enable-symbol-highlighting nil
          company-lsp-enable-recompletion nil
          lsp-prefer-capf t
          doom-modeline-lsp nil)
Hope this helps


What languages/backends do you use with lsp?


I use it only for clojure right now


probably not, there's not even a release candidate for 27 tagged yet:


It’s not, but afaik 26 can’t be patched to support jansson. Jansson is a C library for encoding, decoding and manipulating JSON. lsp with jansson is much more faster.


@yyoncho reports that elisp native compilation makes it even more faster (like 300% more). I can’t wait for it to be released. Sadly, it would probably take at least another year or so.


I believe that elips native compilation is a branch off Emacs 28 at the moment, so yes, a little while before that is generally available.


Elisp native compilation? Are they finally migrating over to Guile? 😛


@deleted-user I've been using GNU Emacs 28.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.22.30, cairo version 1.15.10) of 2020-02-22 (updating from HEAD) weekly for months now without issues - using cider and clojure-mode pinned to MELPA stable


My cider particulars are:

;; Connected to nREPL server - 
;; CIDER 0.24.0 (India), nREPL 0.6.0
;; Clojure 1.10.1, Java 11.0.5
;;     Docs: (doc function-name)
;;           (find-doc part-of-name)
;;   Source: (source function-name)
;;  Javadoc: (javadoc java-object-or-class)
;;     Exit: <C-c C-q>
;;  Results: Stored in vars *1, *2, *3, an exception in *e;
;;  Startup: /usr/local/bin/clojure -Sdeps '{:deps {nrepl {:mvn/version "0.6.0"} cider/piggieback {:mvn/version "0.4.2"} refactor-nrepl {:mvn/version "2.4.0"} cider/cider-nrepl {:mvn/version "0.24.0"}}}' -A:dev:test:system-test:backend:frontend -m nrepl.cmdline --middleware '["refactor-nrepl.middleware/wrap-refactor", "cider.nrepl/cider-middleware", "cider.piggieback/wrap-cljs-repl"]'
;; ClojureScript REPL type: figwheel-main


I'll bet I can get emacs-plus head from homebrew


brew install emacs-plus --HEAD --verbose --with-jansson --with-xwidgets


The Emacs team are working on a release for Emacs 27 and started discussing that back in November 2019. Not sure how long it will take (not as long as Emacs 21).


If you use Ubuntu Linux you can get nightly builds of Emacs 28 as via the emacs-snapshot package by adding the Ubuntu Emacs Lisp private package archive I have been running Emacs 27 snapshot from there for a while. As it called a different name, you can have both Emacs stable and snapshot installed an run which ever version you want.


I wonder if I can have two versions in homebrew as well


My understanding is Homebrew only provides the release. You could try creating your own tap though, but not sure if that overrides the usual brew.