lsp-origami
lsp-origami copied to clipboard
lsp-origami-try-enable doesn't start lsp-origami-mode even if the server supports foldingRangeProvider
Using the following (part of) my .emacs:
(use-package lsp-origami
:ensure t
:bind
(:map origami-mode-map
(("C-c f h" . origami-close-node)
("C-c f s" . origami-open-node)
("C-c f f" . origami-recursively-toggle-node)
("C-c f a" . origami-close-all-nodes)
("C-c f z" . origami-open-all-nodes)
("C-c f g" . origami-show-only-node)
)))
(use-package lsp-mode
:ensure t
:init
(setq lsp-keymap-prefix "C-c l")
:config
(setq lsp-enable-snippet nil)
:hook
(
;; (lsp-mode . lsp-origami-mode)
;; (lsp-mode . origami-mode)
(lsp-mode . lsp-origami-try-enable)
)
:commands lsp)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Python mode
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(use-package python
:mode ("\\.py\\'" . python-mode)
:interpreter ("python" . python-mode)
:config
(use-package python-black)
:hook
(
(python-mode . python-black-on-save-mode)
(python-mode . lsp)
(python-mode . show-paren-mode)
)
)
I get different behaviour depending on whether I use the lsp-origami-try-enable hook or the two commented hooks (which start origami and lsp-origami explicitly). For example, explicitly starting lsp-origami-mode allows me to fold on a while: inside a function definition, which does not work with just origami.
I'm on ubuntu 20.04
emacs --version: 26.3
All packages installed through MELPA.
pip show python-language-server:
Name: python-language-server
Version: 0.36.2
Summary: Python Language Server for the Language Server Protocol
Home-page: https://github.com/palantir/python-language-server
Author: Palantir Technologies, Inc.
Author-email: None
License: UNKNOWN
Location: /home/scmb/.local/lib/python3.8/site-packages
Requires: pluggy, ujson, python-jsonrpc-server, jedi
Required-by:
I think this is actually due to using lsp-mode hook rather than lsp-after-open in the:hook block. I will play around with it a little more, and probably close this issue if it seems to work.