From d95644c0f6684fc4e57462bbbc790973a8367af4 Mon Sep 17 00:00:00 2001 From: kosayoda Date: Wed, 1 Jul 2020 10:26:08 +0800 Subject: Remove call to get Python interpreter and version. By default, the Microsoft Python Language Server already gets an existing Python interpreter and version from $PATH if the setting is an empty string or null. https://github.com/microsoft/python-language-server/blob/838ba78e00173d639bd90f54d8610ec16b4ba3a2/src/LanguageServer/Impl/Implementation/Server.cs#L143 Looking for `python` and launching the interpreter to get the version on our end is redundant and time-consuming. --- lua/nvim_lsp/pyls_ms.lua | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'lua') diff --git a/lua/nvim_lsp/pyls_ms.lua b/lua/nvim_lsp/pyls_ms.lua index fa8241b4..6b66a600 100644 --- a/lua/nvim_lsp/pyls_ms.lua +++ b/lua/nvim_lsp/pyls_ms.lua @@ -3,13 +3,6 @@ local util = require 'nvim_lsp/util' local name = "pyls_ms" -local function get_python_version() - local f = io.popen("python --version 2>&1") -- runs command - local l = f:read("*a") -- read output of command - f:close() - return l:match("^Python%s*(...).*%s*$") -end - local function get_latest_pyls() local f = io.popen("curl -k --silent 'https://pvsc.blob.core.windows.net/python-language-server-stable?restype=container&comp=list&prefix=Python-Language-Server-osx-x64'") local l = f:read("*a") @@ -110,8 +103,8 @@ configs[name] = { interpreter = { properties = { - InterpreterPath = vim.fn.exepath("python"); - Version = get_python_version(); + InterpreterPath = ""; + Version = ""; }; }; displayOptions = {}; @@ -139,6 +132,13 @@ If you want to use your own build, set cmd to point to `Microsoft.Python.languag cmd = { "dotnet", "exec", "path/to/Microsoft.Python.languageServer.dll" }; ``` +If the `python` interpreter is not in your PATH environment variable, set the `InterpreterPath` and `Version` properties accordingly. + +```lua +InterpreterPath = "path/to/python", +Version = "3.8" +``` + This server accepts configuration via the `settings` key. ]]; -- cgit v1.2.3-70-g09d2