Switch to LSP for mypy

This commit is contained in:
Kovid Goyal 2024-03-28 19:36:07 +05:30
parent 4b282211de
commit c9f8596357
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
4 changed files with 7 additions and 29 deletions

View File

@ -1,6 +1,7 @@
#!/usr/bin/env python
# License: GPL v3 Copyright: 2016, Kovid Goyal <kovid at kovidgoyal.net>
# Imports {{{
import atexit
import base64
import json
@ -154,6 +155,7 @@
if TYPE_CHECKING:
from .rc.base import ResponseType
# }}}
RCResponse = Union[Dict[str, Any], None, AsyncResponse]

View File

@ -1,19 +0,0 @@
#!/usr/bin/env python
import os
import subprocess
import sys
base = os.path.dirname(os.path.abspath(__file__))
files = [os.path.relpath(x, base) for x in sys.argv[1:] if not x.startswith('-')]
if not files:
raise SystemExit(subprocess.Popen(['mypy'] + sys.argv[1:]).wait())
output = subprocess.run('dmypy run -- --follow-imports=error --show-column-numbers --no-color-output'.split(), stdout=subprocess.PIPE).stdout
q = files[0] + ':'
rc = 0
for line in output.decode('utf-8').splitlines():
if line.startswith(q):
print(line)
rc = 1
raise SystemExit(rc)

View File

@ -16,6 +16,11 @@ disallow_incomplete_defs = true
strict = true
no_implicit_reexport = true
[tool.pylsp-mypy]
enabled = true
dmypy = true
report_progress = true
[tool.ruff]
line-length = 160
target-version = 'py38'

View File

@ -1,15 +1,5 @@
" Scan the following dirs recursively for tags
let g:project_tags_dirs = ['kitty', 'kittens', 'tools']
if exists('g:ale_linters')
let g:ale_linters['python'] = ['mypy', 'ruff']
else
let g:ale_linters = {'python': ['mypy', 'ruff']}
endif
let g:ale_python_mypy_executable = './mypy-editor-integration'
let g:ale_fixers = {
\ "python": ["ruff"],
\}
autocmd FileType python noremap \i :ALEFix<CR>
set wildignore+==template.py
set wildignore+=tags
set expandtab