When using pylsp with Neovim, I get errors such as E302 expected 2 blank lines, found 1
and E741 ambiguous variable name 'l'
. Simple formatting errors such as these seem pointless to me and clutter my workspace. How would I go about configuring pylsp to not show these errors?
For reference, my nvim config directory looks like this:
├── lua
│ ├── plugins
│ │ ├── alpha-nvim.lua
│ │ ├── gitsigns.lua
│ │ ├── gruvbox.lua
│ │ ├── harpoon.lua
│ │ ├── lsp-config.lua
│ │ ├── lualine.lua
│ │ ├── simple-plugins.lua
│ │ ├── telescope.lua
│ │ ├── treesitter.lua
│ │ ├── which-key.lua
│ │ └── yazi.lua
│ ├── keymaps.lua
│ └── options.lua
├── init.lua
└── lazy-lock.json
I use lazy.nvim for my plugin manager, and Mason, mason-lspconfig, and lspconfig to install and manage my LSPs. All of my lsp configuration is in the file lsp-config.lua
, the contents of which are as follows:
return {
{
"williamboman/mason.nvim",
config = function()
require("mason").setup()
end
},
{
"williamboman/mason-lspconfig.nvim",
config = function()
require("mason-lspconfig").setup({
ensure_installed = {
"clangd",
"pylsp",
"lua_ls",
"texlab",
}
})
end
},
{
"neovim/nvim-lspconfig",
config = function()
local lspconfig = require("lspconfig")
lspconfig.clangd.setup({})
lspconfig.pylsp.setup({})
lspconfig.lua_ls.setup({})
lspconfig.texlab.setup({})
end
},
{
"nvim-telescope/telescope-ui-select.nvim",
config = function()
require("telescope").setup({
extensions = {
["ui-select"] = {
require("telescope.themes").get_dropdown {
}
}
}
})
require("telescope").load_extension("ui-select")
end
},
}
This post seems to be very similar to my question, but I don’t know where the person is putting this code.
ethananthony271 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.