mirror of
https://github.com/kovidgoyal/kitty.git
synced 2026-05-13 08:26:56 +00:00
Switch to LSP for mypy
This commit is contained in:
parent
4b282211de
commit
c9f8596357
4 changed files with 7 additions and 29 deletions
|
|
@ -1,6 +1,7 @@
|
||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
# License: GPL v3 Copyright: 2016, Kovid Goyal <kovid at kovidgoyal.net>
|
# License: GPL v3 Copyright: 2016, Kovid Goyal <kovid at kovidgoyal.net>
|
||||||
|
|
||||||
|
# Imports {{{
|
||||||
import atexit
|
import atexit
|
||||||
import base64
|
import base64
|
||||||
import json
|
import json
|
||||||
|
|
@ -154,6 +155,7 @@ from .window import CommandOutput, CwdRequest, Window
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from .rc.base import ResponseType
|
from .rc.base import ResponseType
|
||||||
|
# }}}
|
||||||
|
|
||||||
RCResponse = Union[Dict[str, Any], None, AsyncResponse]
|
RCResponse = Union[Dict[str, Any], None, AsyncResponse]
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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)
|
|
||||||
|
|
@ -16,6 +16,11 @@ disallow_incomplete_defs = true
|
||||||
strict = true
|
strict = true
|
||||||
no_implicit_reexport = true
|
no_implicit_reexport = true
|
||||||
|
|
||||||
|
[tool.pylsp-mypy]
|
||||||
|
enabled = true
|
||||||
|
dmypy = true
|
||||||
|
report_progress = true
|
||||||
|
|
||||||
[tool.ruff]
|
[tool.ruff]
|
||||||
line-length = 160
|
line-length = 160
|
||||||
target-version = 'py38'
|
target-version = 'py38'
|
||||||
|
|
|
||||||
10
session.vim
10
session.vim
|
|
@ -1,15 +1,5 @@
|
||||||
" Scan the following dirs recursively for tags
|
" Scan the following dirs recursively for tags
|
||||||
let g:project_tags_dirs = ['kitty', 'kittens', 'tools']
|
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+==template.py
|
||||||
set wildignore+=tags
|
set wildignore+=tags
|
||||||
set expandtab
|
set expandtab
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue