Skip to content

Settings for Microsoft Python Language Server #633

@hanspinckaers

Description

@hanspinckaers

Hi,

I'm trying to get Microsoft Python Language Server working. Sadly, I can't get it to work. I'm seeing this error when enabling the highest logging level:

10:08:18 INFO reader-python src/vim.rs:380 <= Some("python") {
  "jsonrpc": "2.0",
  "id": 9,
  "error": {
    "code": -32000,
    "message": "Object reference not set to an instance of an object.",
    "data": {
      "stack": "   at Microsoft.Python.LanguageServer.Implementation.LanguageServer.Initialize(JToken token, CancellationToken cancellationToken) in /mnt/data/python-language-server/src/LanguageServer/Impl/LanguageServer.Lifetime.cs:line 41",
      "code": "-2147467261"
    }
  }
}

I think this is related to certain initializationOptions that need to be set. They should be like these:
https://github.com/Microsoft/python-language-server/blob/master/Using_in_sublime_text.md

{
    "clients":
    {
        "mspyls":
        {
            "command": [ "dotnet.exe", "exec", "C:\\python-language-server\\Microsoft.Python.LanguageServer.dll" ],
            "scopes": ["source.python"],
            "syntaxes": ["Packages/Python/Python.sublime-syntax"],
            "languageId": "python",
            "initializationOptions": 
            {
                "interpreter": 
                {
                    "properties": 
                    {
                        "UseDefaultDatabase": true,
                        "Version": "3.7"
                    }                    
                }
            }
        }
    }
}

I've tried various syntax in settings.json, but I cannot seem to get it to work. My current settings.json:

{
    "python": {
        "UseDefaultDatabase": true,
        "Version": "3.6.4"
    }
}

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions