Skip to content

Latest commit

 

History

History
55 lines (43 loc) · 2.28 KB

README.org

File metadata and controls

55 lines (43 loc) · 2.28 KB

lsp-mode client leveraging Microsoft’s python-language-server.

Installation

Include lsp-python-ms in the configuration file:

(require 'lsp-python-ms)
(add-hook 'python-mode #'lsp) ; or lsp-deferred

A minimal use-package initialization might be:

(use-package lsp-python-ms
  :ensure t
  :hook (python-mode . (lambda ()
                          (require 'lsp-python-ms)
                          (lsp))))  ; or lsp-deferred

Normally the python-language-server will be downloaded automatically if it doesn’t exist while opening the python scripts.

If you have troubles to download the package, you can also build the server yourselves.

  1. Install dotnet-sdk
  2. Clone and build python-language-server:
    git clone https://github.com/Microsoft/python-language-server.git
    cd python-language-server/src/LanguageServer/Impl
    dotnet publish -c Release -r osx-x64   # mac
        

    Change the -r flag according to your architecture and operating system. See Microsoft’s Runtime ID Catalog for the right value for your system.

    Then make the binary executable.

    chmod a+x $(git rev-parse --show-toplevel)/output/bin/Release/osx-x64/publish/Microsoft.Python.LanguageServer
        

    NOTE: on some systems (for example, Fedora), the executable comes out as Microsoft.Python.LanguageServer.LanguageServer.

  3. Set executable to lsp-python-ms-executable.
    ;; 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 development, you might find it useful to run cask install.

Credit

All credit to cpbotha on vxlabs! This just tidies and packages his work there