Fork me on GitHub
#emacs
<
2020-02-24
>
ag03:02:17

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 https://github.com/emacs-lsp/lsp-mode#performance - 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

solf03:02:37

What languages/backends do you use with lsp?

ag05:02:39

I use it only for clojure right now

EmmanuelOga04:02:58

probably not, there's not even a release candidate for 27 tagged yet: http://git.savannah.gnu.org/cgit/emacs.git/refs/tags

ag05:02:06

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.

ag05:02:40

@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.

practicalli-johnny11:02:15

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.

zilti11:02:27

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

codeasone16:02:07

@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

codeasone16:02:54

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

deleted17:02:59

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

ag18:02:22

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

practicalli-johnny18:02:50

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).

practicalli-johnny18:02:10

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 https://launchpad.net/~ubuntu-elisp/+archive/ubuntu/ppa 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.

deleted18:02:27

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

practicalli-johnny20:02:21

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.