有没有朋友提供下python LSP补全的配置文件,参考网上的配置都没成功

如题…………

参考M-EMACS

这个不行吗?

GitHub - emacs-lsp/lsp-mode: Emacs client/library for the Language Server Protocol + GitHub - palantir/python-language-server: An implementation of the Language Server Protocol for Python 直接用没什么问题呀,

安装 server

pip install 'python-language-server[all]'

供参考:https://github.com/jiacai2050/dotfiles/blob/19974c7cee1e526dc5d0f8e4683c22ac82285ddd/.emacs.d/customizations/setup-common.el#L7

谢谢楼上朋友的回复,已经可以用了,就是company-box那个文档提示占用面积太大,能不能设置手动,需要时在弹出?

我现在用的是eglot,

lsp-python-ms一直报错: File mode specification error: (void-variable lsp-server-install-dir)

除了README,还设置了

(setq lsp-python-ms-dir "~/.emacs.d/site-lisp/"
	lsp-python-ms-executable "~/path/to/output/bin/Release/linux-x64/publish/Microsoft.Python.LanguageServer")

可以帮忙解答吗?

lsp-python-ms依赖于lsp-mode,不是用于 eglot 的。

我可能断句不明显,:rofl:

我现在用的是eglot,但是还想试试lsp-python-ms,主要比较一下速度,但是却总是报错:File mode specification error: (void-variable lsp-server-install-dir)这句一直没解决。

几处抄来的配置综合起来:

(use-package lsp-python-ms
  :defer t
  :after lsp-mode python
  ;; :if (or *python3* *python*)
  :hook
  (python-mode . (lambda ()
		   (require 'lsp-python-ms)
		   (lsp)))
  :custom
  (lsp-python-executable-cmd "python3")
  :config
  (setq lsp-python-ms-dir "~/.emacs.d/site-lisp/"
	lsp-python-ms-executable "~/.emacs.d/site-lisp/Microsoft.Python.LanguageServer"))

升级 lsp-modelsp-server-install-dirlsp-mode 中定义的。

1 个赞