lsp-mode client leveraging microsoft’s python-language-server
Installation
- Install dotnet-sdk
- Clone and install python-language-server:
git clone https://github.com/Microsoft/python-language-server.git cd python-language-server/src/LanguageServer/Impl dotnet build -c Release
If you choose, compile the language server to a single executable with:
dotnet publish -c Release -r osx-x64 # mac
change the value of the
-r
flag depending on your architecture and operating system. See Microsoft’s Runtime ID Catalog for the right value for your system.Then, link the executable to somewhere on your path, e.g.
ln -sf $(git rev-parse --show-toplevel)/output/bin/Release/osx-x64/publish/Microsoft.Python.LanguageServer ~/.local/bin/
note that, on some systems (for example, Fedora), the executable comes out as
Microsoft.Python.LanguageServer.LanguageServer
. - Include
lsp-python-ms
in your config in your preferred manner. A minimaluse-package
initialization might be:(use-package lsp-python-ms :ensure nil :hook (python-mode . lsp) :config ;; for dev build of language server (setq lsp-python-ms-dir (expand-file-name "~/python-language-server/output/bin/Release/")) ;; for executable of language server, if it's not symlinked on your PATH (setq lsp-python-ms-executable "~/python-language-server/output/bin/Release/osx-x64/publish/Microsoft.Python.LanguageServer"))
For developement, you might find it useful to run cask install
.
Credit
All credit to cpbotha on vxlabs! This just tidies and packages his work there