Describe the bug
The README.md of lsp-mode and several lsp-mode plugins state that one should use lsp-define-stdio-client to add new language servers. However I get the message "No op - only for backward compatibility.", which stems from lsp. el.
To Reproduce
Add something like this to your init.el:
(lsp-define-stdio-client lsp-python "python"
#'projectile-project-root
'("pyls"))
Expected behavior
The function lsp-python-enable would be generated.
Which Language Server did you use
lsp-python.
OS
Ubuntu 16.04 LTS
Error callstack
N/A
Please refer to https://github.com/emacs-lsp/lsp-mode/blob/master/README-NEXT.md and https://github.com/emacs-lsp/lsp-mode/issues/479 . We are in a process of deprecating lsp-mode.el. It is still usable, but once you require lsp.el you have to use only the lsp-mode NEXT stuff.
Ok, so is this the new syntax then?
(lsp-register-client
(make-lsp-client :new-connection (lsp-stdio-connection "pyls")
:major-modes '(python-mode)
:server-id 'pyls))
Maybe you should add a section "Upgrading from old lsp-mode versions" to the README then, also mention this in the old README.
Yes. As a side note, the pyls definition is part of lsp-clients.el and you no longer need additional packages for it along with several others languages.
Ok, understood. But how do I then activate lsp in python-mode? I tried simply M-x lsp-mode, but all I get is LSP(disconnected) in the modeline.
Call lsp
Then I get: user-error: Unable to find client(s) handling python-mode
as per README:
Some of the servers are directly supported by lsp-mode by requiring lsp-clients.el while other require installing additional package which provide server specific functionality.
and to quote you:
Yes. As a side note, the pyls definition is part of lsp-clients.el and you no longer need additional packages for it along with several others languages.
So what is it then? Does python-mode now need some extra package + setup, or not? It's all quite confusing at the moment...
All the information is present in the readme I linked - there is a table in https://github.com/emacs-lsp/lsp-mode/blob/master/README-NEXT.md which lists what are the clients that are part of lsp-clients.el and what clients do require additional packages. It also lists what do you need to do to install the language server.
Sorry, that really does not help. e.g. the table refers to cquery, which still lists old installation instructions. After the latest MELPA update lsp also broke cquery support. lsp-cquery-enable is not there anymore either, probably due to the same reason I filed this bug report in the first place. I still say you need to document an upgrade path for users of the old lsp mode. At the moment I have a broken installation where neither python nor cquery servers are working. And the README-NEXT.md says nothing about upgrading from older versions. For the time being I will try to downgrade to an older version of lsp-mode. Though not sure how to do it, since I never tried that.
To use the old version you should not require lsp.el but only lsp-mode.el. As you can see the cquery is marked as TBD - that means it is not ported to lsp.el. You could migrate to lsp.el once all of the clients that you are using are migrated to lsp.el.
Actually - cquery is using the new interface lsp.el. The only configuration to that you need to do is:
(require 'lsp-clients)
(require 'cquery)
(add-hook 'python-mode-hook 'lsp)
(add-hook 'c++-mode-hook 'lsp)
I think I have cquery now running... I also realised that I was still triggering lsp-mode, instead of lsp upon entering programming-mode. So that is more or less fixed.
For cquery I simply removed the hook to lsp-cquery-enable. At least I can now manually enable lsp in c++-mode files.
Thanks, that is pretty much what I did. :)
https://github.com/emacs-lsp/lsp-mode/blob/master/README-NEXT.md link is broken now is there a newer one?
@jgarvin it is moved in README.org (the home page of the REPO).
Most helpful comment
https://github.com/emacs-lsp/lsp-mode/blob/master/README-NEXT.md link is broken now is there a newer one?