commit a24f1905316e7a146f922683e0f32c0e59f37503
parent ed8fbd2e2992cb264cb62585098a1c7acc5c4585
Author: zeertzjq <zeertzjq@outlook.com>
Date: Sun, 8 Feb 2026 07:06:51 +0800
vim-patch:1ff2239: runtime(compiler): add pyright Python type checker
closes: vim/vim#19017
https://github.com/vim/vim/commit/1ff2239053684add9ead3c121e12169e7682db7a
Co-authored-by: Konfekt <Konfekt@users.noreply.github.com>
Diffstat:
2 files changed, 32 insertions(+), 0 deletions(-)
diff --git a/runtime/compiler/pyright.vim b/runtime/compiler/pyright.vim
@@ -0,0 +1,25 @@
+" Vim compiler file
+" Compiler: Pyright (Python Type Checker)
+" Maintainer: @konfekt
+" Last Change: 2025 Dec 26
+
+if exists("current_compiler") | finish | endif
+let current_compiler = "pyright"
+
+let s:cpo_save = &cpo
+set cpo&vim
+
+" CompilerSet makeprg=pyright
+" CompilerSet makeprg=basedpyright
+exe 'CompilerSet makeprg=' .. escape(
+ \ get(b:, 'pyright_makeprg', get(g:, 'pyright_makeprg', 'pyright')),
+ \ ' \|"')
+CompilerSet errorformat=
+ \%E%f:%l:%c\ -\ error:\ %m,
+ \%W%f:%l:%c\ -\ warning:\ %m,
+ \%N%f:%l:%c\ -\ note:\ %m,
+ \%C[ \t]\ %.%#,
+ \%-G%.%#
+
+let &cpo = s:cpo_save
+unlet s:cpo_save
diff --git a/runtime/doc/quickfix.txt b/runtime/doc/quickfix.txt
@@ -1656,6 +1656,13 @@ b/g:mypy_makeprg_params variable. For example: >
The global default is "--strict --ignore-missing-imports".
+PYRIGHT TYPE CHECKER *compiler-pyright*
+
+Commonly used compiler options can be added to 'makeprg' by setting the
+b/g:pyright_makeprg_params variable.
+
+The global default is "pyright".
+
TY TYPE CHECKER *compiler-ty*
Commonly used compiler options and executable can be set by the