I want python language server support with auto completion and syntax highlighting. I cloned the lsp-pyright repo from their github-page. After that, I wanted to load the path and use it. But somehow I get an error (run with --debug-init):
Debugger entered--Lisp error: (file-missing "Cannot open load file" "No such file or directory" "lsp-mode")
require(lsp-mode)
eval-buffer(#<buffer *load*-106525> nil "/home/johannes/.emacs.d/lsp-pyright/lsp-pyright.el" nil t) ; Reading at buffer position 1077
load-with-code-conversion("/home/johannes/.emacs.d/lsp-pyright/lsp-pyright.el" "/home/johannes/.emacs.d/lsp-pyright/lsp-pyright.el" nil t)
require(lsp-pyright)
eval-buffer(#<buffer *load*> nil "/home/johannes/.emacs.d/init.el" nil t) ; Reading at buffer position 901
load-with-code-conversion("/home/johannes/.emacs.d/init.el" "/home/johannes/.emacs.d/init.el" t t)
load("/home/johannes/.emacs.d/init" noerror nomessage)
startup--load-user-init-file(#f(compiled-function () #<bytecode 0x9e00fc3fd2117b8>) #f(compiled-function () #<bytecode -0x1f3c686ddc0cdc35>) t)
command-line()
normal-top-level()
Debugger entered--Lisp error: (file-missing "Cannot open load file" "No such file or directory" "lsp-mode")
I am confused, because doing that for emacs-evil worked fine for me. Why not set up an lsp-server like that (I don't even know if this is a sensible try..)?
I could also use eglot. In fact, I used eglot with clangd for C++ development already and it works like a charm.
This is my entire init.el file:
(setq inhibit-startup-screen t)
(menu-bar-mode 0)
(tool-bar-mode 0)
(scroll-bar-mode 0)
(custom-set-variables
'(custom-safe-themes
'("d80952c58cf1b06d936b1392c38230b74ae1a2a6729594770762dc0779ac66b7" default))
'(package-selected-packages '(el-search treeview gruvbox-theme eglot)))
(custom-set-faces)
;;evil
(add-to-list 'load-path "~/.emacs.d/evil/")
(require 'evil)
(evil-mode 1)
;;tabstop
(setq-default tab-width 4)
;;clangd
(require 'eglot)
(add-to-list 'eglot-server-programs '((c++-mode c-mode) "clangd"))
(add-hook 'c-mode-hook 'eglot-ensure)
(add-hook 'c++-mode-hook 'eglot-ensure)
;;emacs theme
(load-theme 'gruvbox-dark-hard t)
;; (add-to-list 'load-path "~/.emacs.d/vendor/pymacs-0.24-beta2")
;; (require 'pymacs)
;; (pymacs-load "ropemacs" "rope-")
;; (setq ropemacs-enable-autoimport t)
;; pyright
(add-to-list 'load-path "~/.emacs.d/lsp-pyright/")
(require 'lsp-pyright)
I tried reading through this to understand how to use eglot in the first place, but that didn't help either.
Putting this in my config didn't help:
(use-package lsp-pyright :ensure t :hook (python-mode . (lambda () (require 'lsp-pyright) (lsp)))) ; or lsp-deferred
I coudln't find any website that illustrates this process in an easy and understandable way. Pyright-Installation(emacs)
It does not have to be pyright btw. Just a tool that works! (like ropemacs). ropemacs This was an interesting read, but after following this step by step, I noticed, that some of these github url's are depecated and no longer usable. (so this didn't work either :( ..)
I know this might be a noob-question, but I just didn't get it to work. How would I go about resolving this? Thanks for any help in advance!