Added python support (lsp, linter, formatter)

This commit is contained in:
Nikita Avgustanov 2026-02-19 09:34:12 +04:00
parent 32584838f6
commit 5233c6a3d2
2 changed files with 19 additions and 2 deletions

View File

@ -88,7 +88,6 @@ P.S. You can delete this when you're done too. It's your config now! :)
-- NOTE: Must happen before plugins are loaded (otherwise wrong leader will be used) -- NOTE: Must happen before plugins are loaded (otherwise wrong leader will be used)
vim.g.mapleader = ' ' vim.g.mapleader = ' '
vim.g.maplocalleader = ' ' vim.g.maplocalleader = ' '
-- Set to true if you have a Nerd Font installed and selected in the terminal -- Set to true if you have a Nerd Font installed and selected in the terminal
vim.g.have_nerd_font = false vim.g.have_nerd_font = false
@ -691,7 +690,14 @@ require('lazy').setup({
bashls = {}, bashls = {},
jsonls = {}, jsonls = {},
yamlls = {}, yamlls = {},
-- pyright = {}, ty = {
configuration = {
rules = {
['unresolved-reference'] = 'warn',
diagnosticMode = 'workspace',
},
},
},
-- rust_analyzer = {}, -- rust_analyzer = {},
-- ... etc. See `:help lspconfig-all` for a list of all the pre-configured LSPs -- ... etc. See `:help lspconfig-all` for a list of all the pre-configured LSPs
-- --
@ -734,6 +740,7 @@ require('lazy').setup({
local ensure_installed = vim.tbl_keys(servers or {}) local ensure_installed = vim.tbl_keys(servers or {})
vim.list_extend(ensure_installed, { vim.list_extend(ensure_installed, {
'stylua', -- Used to format Lua code 'stylua', -- Used to format Lua code
'ruff',
}) })
require('mason-tool-installer').setup { ensure_installed = ensure_installed } require('mason-tool-installer').setup { ensure_installed = ensure_installed }
@ -745,6 +752,7 @@ require('lazy').setup({
'solargraph', 'solargraph',
'bashls', 'bashls',
'lua_ls', 'lua_ls',
'ty',
}, -- explicitly set to an empty table (Kickstart populates installs via mason-tool-installer) }, -- explicitly set to an empty table (Kickstart populates installs via mason-tool-installer)
automatic_installation = false, automatic_installation = false,
handlers = { handlers = {
@ -794,6 +802,14 @@ require('lazy').setup({
formatters_by_ft = { formatters_by_ft = {
lua = { 'stylua' }, lua = { 'stylua' },
go = { 'gofmt' }, go = { 'gofmt' },
python = {
-- To fix auto-fixable lint errors.
'ruff_fix',
-- To run the Ruff formatter.
'ruff_format',
-- To organize the imports.
'ruff_organize_imports',
},
-- Conform can also run multiple formatters sequentially -- Conform can also run multiple formatters sequentially
-- python = { "isort", "black" }, -- python = { "isort", "black" },
-- --

View File

@ -7,6 +7,7 @@ return {
local lint = require 'lint' local lint = require 'lint'
lint.linters_by_ft = { lint.linters_by_ft = {
markdown = { 'markdownlint' }, markdown = { 'markdownlint' },
python = { 'ruff' },
} }
-- To allow other plugins to add linters to require('lint').linters_by_ft, -- To allow other plugins to add linters to require('lint').linters_by_ft,