mirror of
https://github.com/NotAShelf/nvf.git
synced 2026-02-23 20:12:00 +00:00
languages/python: add mypy (#1395)
This commit is contained in:
parent
1355f90240
commit
4d2f488358
2 changed files with 31 additions and 1 deletions
|
|
@ -173,6 +173,9 @@
|
|||
|
||||
- Added XML syntax highlighting, LSP support and formatting
|
||||
|
||||
- Added [mypy](https://www.mypy-lang.org/) to `languages.python` for extra
|
||||
diagnostics.
|
||||
|
||||
- Added [tera](https://keats.github.io/tera/) language support (syntax
|
||||
highlighting only).
|
||||
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@
|
|||
inherit (lib.modules) mkIf mkMerge;
|
||||
inherit (lib.types) enum package bool;
|
||||
inherit (lib.nvim.attrsets) mapListToAttrs;
|
||||
inherit (lib.nvim.types) deprecatedSingleOrListOf;
|
||||
inherit (lib.nvim.types) deprecatedSingleOrListOf diagnostics;
|
||||
inherit (lib.generators) mkLuaInline;
|
||||
inherit (lib.nvim.dag) entryBefore;
|
||||
inherit (lib.trivial) warn;
|
||||
|
|
@ -278,6 +278,14 @@
|
|||
'';
|
||||
};
|
||||
};
|
||||
defaultDiagnosticsProvider = ["mypy"];
|
||||
diagnosticsProviders = {
|
||||
mypy = {
|
||||
config = {
|
||||
cmd = getExe' pkgs.mypy "mypy";
|
||||
};
|
||||
};
|
||||
};
|
||||
in {
|
||||
options.vim.languages.python = {
|
||||
enable = mkEnableOption "Python language support";
|
||||
|
|
@ -335,6 +343,15 @@ in {
|
|||
'';
|
||||
};
|
||||
};
|
||||
|
||||
extraDiagnostics = {
|
||||
enable = mkEnableOption "extra Python diagnostics" // {default = config.vim.languages.enableExtraDiagnostics;};
|
||||
types = diagnostics {
|
||||
langDesc = "Python";
|
||||
inherit diagnosticsProviders;
|
||||
inherit defaultDiagnosticsProvider;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable (mkMerge [
|
||||
|
|
@ -404,5 +421,15 @@ in {
|
|||
vim.debugger.nvim-dap.enable = true;
|
||||
vim.debugger.nvim-dap.sources.python-debugger = debuggers.${cfg.dap.debugger}.dapConfig;
|
||||
})
|
||||
|
||||
(mkIf cfg.extraDiagnostics.enable {
|
||||
vim.diagnostics.nvim-lint = {
|
||||
enable = true;
|
||||
linters_by_ft.python = cfg.extraDiagnostics.types;
|
||||
linters =
|
||||
mkMerge (map (name: {${name} = diagnosticsProviders.${name}.config;})
|
||||
cfg.extraDiagnostics.types);
|
||||
};
|
||||
})
|
||||
]);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue