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

Broken with use-package #558

Closed
wrachwal opened this issue Dec 19, 2018 · 7 comments
Closed

Broken with use-package #558

wrachwal opened this issue Dec 19, 2018 · 7 comments

Comments

@wrachwal
Copy link

When lsp-mode is used with use-package, its :config is not executed when lsp function is called.
My guess: lsp autoloads lsp.el, but not lsp-mode.el.

With the code below, when I visit .ex file I get:
Unable to find client(s) handling elixir-mode. Make sure you have required lsp-clients.el or proper extension.

Noticed on commit 5651535 and for sure it worked when I was on c5ea1f26.

(use-package elixir-mode
  :interpreter "elixir"
  :gfhook #'lsp)

(use-package lsp-mode
  :commands lsp
  :config
  (require 'lsp-clients)
  (lsp-register-client
   (make-lsp-client :new-connection (lsp-stdio-connection "elixir-ls")
                    :major-modes '(elixir-mode)
                    :server-id 'elixir-ls)))

After recent reorganisations shouldn't the content of lsp.el landed in lsp-mode.el, and, if for some backward compatibility you still need to have lsp.el existed, just to require lsp-mode from it, and not vice versa?

@yyoncho
Copy link
Member

yyoncho commented Dec 19, 2018

Can you try

(use-package lsp
...

Edit: Disregard this comment, I will do deeper analysis.

@wrachwal
Copy link
Author

(use-package lsp
...
error: Could not find package lsp in recipe repositories: (org-elpa melpa gnu-elpa emacsmirror)

I didn't mention I use straight, but it should not matter.

@yyoncho
Copy link
Member

yyoncho commented Dec 19, 2018

After recent reorganisations shouldn't the content of lsp.el landed in lsp-mode.el, and, if for some backward compatibility you still need to have lsp.el existed, just to require lsp-mode from it, and not vice versa?

I was thinking about this but I am a bit concerned about breaking lsp-mode users configuration,

I tried the following, and it seems to work with emacs -q

(condition-case nil
    (require 'use-package)
  (file-error
   (require 'package)
   (package-initialize)
   (package-refresh-contents)
   (package-install 'use-package)
   (require 'use-package)))

(add-to-list 'package-archives '("melpa" . "http://melpa.org/packages/"))

(use-package lsp-mode :ensure t)

(use-package lsp
  :commands 'lsp
  :ensure nil
  :config
  (message "Called..."))

@wrachwal
Copy link
Author

Do you want to advertise such constructs?
I think you would not break anything when:

  • move stuff from lsp.el to lsp-mode.el (obviously URL/Package-Requires/Version remain in lsp-mode.el)
  • in the slimmed lsp.el just (require 'lsp-mode)

@yyoncho
Copy link
Member

yyoncho commented Dec 19, 2018

@wrachwal you might be right. I am trying to be more cautious. @MaskRay what do you think about @wrachwal's proposal?

By the way, you may consider contributing elixir-ls server configuration to lsp-clients.el .

@MaskRay
Copy link
Member

MaskRay commented Dec 20, 2018

Since this repo is still named lsp-mode, I prefer lsp-mode and moving lsp.el to lsp-mode.el.

(def-package! lsp-mode
  :load-path "~/Dev/Emacs/lsp-mode"
  :commands lsp
  :init
  (setq lsp-auto-guess-root t)
  )

@yyoncho
Copy link
Member

yyoncho commented Dec 20, 2018

ok, PR at #563 . Hopefully, we won't break a lot of configurations.

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

3 participants