From 886ef7bd76b08d86de3bca6ed9373d2e95c31c55 Mon Sep 17 00:00:00 2001 From: Jonathan Date: Sat, 8 Apr 2023 19:36:17 -0500 Subject: feat: add pylyzer lsp config (#2548) * feat(server_configurations): add pylyzer lsp config Added a configuration for the pylyzer LSP. Made sure not to edit any docs, only the Lua source code. * style(linting): make the linter happy for pylyzer Got an error that I can't use `util.path.dirname()` when finding the root directory so I took that out. * fix(pylyzer): windows support Now checks for windows support and runs cmd.exe if it's running on Windows. * fix(pylyzer): no more linting errors Fixed the linting errors even if I disagree with the style. --- lua/lspconfig/server_configurations/pylyzer.lua | 40 +++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 lua/lspconfig/server_configurations/pylyzer.lua (limited to 'lua') diff --git a/lua/lspconfig/server_configurations/pylyzer.lua b/lua/lspconfig/server_configurations/pylyzer.lua new file mode 100644 index 00000000..5b90d494 --- /dev/null +++ b/lua/lspconfig/server_configurations/pylyzer.lua @@ -0,0 +1,40 @@ +local util = require('lspconfig').util + +local bin_name = 'pylyzer' +local cmd = { bin_name, '--server' } + +if vim.fn.has 'win32' == 1 then + cmd = { 'cmd.exe', '/C', bin_name, '--server' } +end + +return { + default_config = { + cmd = cmd, + filetypes = { 'python' }, + root_dir = function(fname) + local root_files = { + 'setup.py', + 'tox.ini', + 'requirements.txt', + 'Pipfile', + 'pyproject.toml', + } + return util.root_pattern(unpack(root_files))(fname) or util.find_git_ancestor(fname) + end, + settings = { + python = { + diagnostics = true, + inlayHints = true, + smartCompletion = true, + checkOnType = false, + }, + }, + }, + docs = { + description = [[ + https://github.com/mtshiba/pylyzer + + `pylyzer`, a fast static code analyzer & language server for Python. + ]], + }, +} -- cgit v1.2.3-70-g09d2