summaryrefslogtreecommitdiff
path: root/lspconfig.lua
blob: 1184af8424cfb97ddc9c761802267c31b5dc6583 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
return {
	"neovim/nvim-lspconfig",
	dependencies = { "williamboman/mason.nvim" },
	config = function()
		-- Define the configuration for pyright using the native API
		vim.lsp.config("pyright", {
			cmd = { "pyright-langserver", "--stdio" },
			filetypes = { "python" },
			root_markers = { "pyproject.toml", "setup.py", "requirements.txt", ".git" },
			settings = {
				python = {
					analysis = {
						autoSearchPaths = true,
						typeCheckingMode = "basic",
					},
				},
			},
		})

		-- Trigger the server start for python files
		vim.api.nvim_create_autocmd("FileType", {
			pattern = "python",
			callback = function(args)
				vim.lsp.start("pyright")
			end,
		})
	end,
}