From 6f992df33fbd254177fec7d69a3ff061e9c33003 Mon Sep 17 00:00:00 2001 From: fishBone000 Date: Mon, 18 Nov 2024 17:08:12 +0000 Subject: [PATCH 1/2] fix: add pylyzer dependenncy info (erg) (#3433) Problem: Pylyzer needs Erg as dependency, such info is missing in configs.md Solution: Add such info in doc, and add `ergPath` setup option --- lua/lspconfig/configs/pylyzer.lua | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/lua/lspconfig/configs/pylyzer.lua b/lua/lspconfig/configs/pylyzer.lua index 34a4914b4c..0fb6b7b933 100644 --- a/lua/lspconfig/configs/pylyzer.lua +++ b/lua/lspconfig/configs/pylyzer.lua @@ -23,12 +23,25 @@ return { checkOnType = false, }, }, + ergPath = vim.fn.getenv('HOME') .. '/.erg', + on_new_config = function(new_config, _) + if new_config.ergPath then + new_config.cmd_env.ERG_PATH = new_config.ergPath + end + end, }, docs = { description = [[ https://github.com/mtshiba/pylyzer `pylyzer`, a fast static code analyzer & language server for Python. + + `pylyzer` requires Erg as dependency, and finds it via `ERG_PATH` environment variable. + By default `ERG_PATH` is set to `~/.erg` when `lspconfig` runs `pylyzer`, + pass `ergPath = "/path/to/erg"` if you want to change it. + + To install Erg, simply extract tarball/zip from [Erg releases](https://github.com/erg-lang/erg/releases/latest) + to the the path where you want to install it, e.g. `~/.erg`. ]], }, } From b0f382f00f4b6696dd925d864bc58159bcadacca Mon Sep 17 00:00:00 2001 From: fishBone000 Date: Wed, 20 Nov 2024 03:54:46 +0000 Subject: [PATCH 2/2] fix: update pylyzer default cfg as per PR comment Remove unnecessary `ergPath` field. --- lua/lspconfig/configs/pylyzer.lua | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/lua/lspconfig/configs/pylyzer.lua b/lua/lspconfig/configs/pylyzer.lua index 0fb6b7b933..d5e163af09 100644 --- a/lua/lspconfig/configs/pylyzer.lua +++ b/lua/lspconfig/configs/pylyzer.lua @@ -23,11 +23,8 @@ return { checkOnType = false, }, }, - ergPath = vim.fn.getenv('HOME') .. '/.erg', on_new_config = function(new_config, _) - if new_config.ergPath then - new_config.cmd_env.ERG_PATH = new_config.ergPath - end + new_config.cmd_env.ERG_PATH = vim.fn.getenv('HOME') .. '/.erg' end, }, docs = { @@ -37,8 +34,8 @@ return { `pylyzer`, a fast static code analyzer & language server for Python. `pylyzer` requires Erg as dependency, and finds it via `ERG_PATH` environment variable. - By default `ERG_PATH` is set to `~/.erg` when `lspconfig` runs `pylyzer`, - pass `ergPath = "/path/to/erg"` if you want to change it. + In the default config `ERG_PATH` is set to `~/.erg`, as shown in the `on_new_config` function. + Add a `on_new_config` on your own if you want to change it. To install Erg, simply extract tarball/zip from [Erg releases](https://github.com/erg-lang/erg/releases/latest) to the the path where you want to install it, e.g. `~/.erg`.