Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lsp-origami-try-enable doesn't start lsp-origami-mode even if the server supports foldingRangeProvider #13

Open
scmbradley opened this issue Apr 3, 2021 · 1 comment

Comments

@scmbradley
Copy link

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: 

@scmbradley
Copy link
Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant