Microsoft Python LSP Configuration

The details below describe how to install and configure the Microsoft Python Language Server found here.
NOTE: This installation process assumes a full version of Python has been installed on the machine.
In addition .Net Core is required to build the language server. The Windows version of the .Net Core installer can be found here.

Building the Language Server

To build the language server perform the following steps:
Open a command line prompt and clone the repository by running the following Git commands:
        c:
        cd \projects
        git clone https://github.com/Microsoft/python-language-server.git
Check that the .Net Core is correctly installed run the following command:
        c:\projects>dotnet --version
This should result in output similar to this:
        6.0.300
Build the language server by running the following commands:
        cd c:\projects\python-language-server\src\LanguageServer\Impl
        dotnet build --configuration Release
This should create the following binary file:
        c:\projects\python-language-server\output\bin\Release\Microsoft.Python.LanguageServer.dll

Configuration

Start Zeus and use the Options, Document Types menu to edit the Python document type and in the Language Server panel apply the following configuration settings:
Program Type: Executable
     Program: dotnet.exe
   Directory: c:\projects\python-language-server\output\bin\Release\
   Arguments: exec
      	      Microsoft.Python.LanguageServer.dll
     Options: {"initializationOptions":{"interpreter":{"properties":{"UseDefaultDatabase": true, "Version": "3.10.5"}}}}

Using an Alternative Python Installation

In the previous example the initialization options sting was defined as follows:
     Options: {"initializationOptions":{"interpreter":{"properties":{"UseDefaultDatabase": true, "Version": "3.10.5"}}}}
With that configuration in place the Language Server will use the python.exe that ships with the Zeus IDE installation. To configure and alternative Python installation use the Version and InterpreterPath details to specify an alternative Python installation as shown below:
     Options: {"initializationOptions":{"interpreter":{"properties":{"UseDefaultDatabase": true, "Version": "3.8.3", "InterpreterPath": "%LOCALAPPDATA%/Programs/Python/Python38-32/Python.exe"}}}}

Using the Language Server

To test the configuration create a simple test.py file and fire off an auto-complete request:
lsp python


Latest Version: Zeus 3.99b
Released: 29th October 2024