mirror of
https://github.com/NotAShelf/nvf.git
synced 2026-06-13 00:08:56 +00:00
commit
e6a92b1b5a
2 changed files with 40 additions and 1 deletions
|
|
@ -561,4 +561,10 @@ https://github.com/gorbit99/codewindow.nvim
|
||||||
|
|
||||||
- Fix `golangci-lint` to lint at the package level.
|
- Fix `golangci-lint` to lint at the package level.
|
||||||
|
|
||||||
|
[Poseidon](https://github.com/poseidon-rises)
|
||||||
|
|
||||||
|
[PHPStan]: https://github.com/phpstan/phpstan
|
||||||
|
|
||||||
|
- Add [PHPStan] as a formatter for `vim.languages.php`.
|
||||||
|
|
||||||
<!-- vim: set textwidth=80: -->
|
<!-- vim: set textwidth=80: -->
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@
|
||||||
inherit (lib.modules) mkIf mkMerge;
|
inherit (lib.modules) mkIf mkMerge;
|
||||||
inherit (lib.types) enum int attrs listOf;
|
inherit (lib.types) enum int attrs listOf;
|
||||||
inherit (lib.nvim.lua) toLuaObject;
|
inherit (lib.nvim.lua) toLuaObject;
|
||||||
inherit (lib.nvim.types) mkGrammarOption;
|
inherit (lib.nvim.types) mkGrammarOption diagnostics;
|
||||||
inherit (lib.nvim.attrsets) mapListToAttrs;
|
inherit (lib.nvim.attrsets) mapListToAttrs;
|
||||||
|
|
||||||
cfg = config.vim.languages.php;
|
cfg = config.vim.languages.php;
|
||||||
|
|
@ -33,6 +33,14 @@
|
||||||
command = "${pkgs.php84Packages.php-cs-fixer}/bin/php-cs-fixer";
|
command = "${pkgs.php84Packages.php-cs-fixer}/bin/php-cs-fixer";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
defaultDiagnosticsProvider = ["phpstan"];
|
||||||
|
|
||||||
|
diagnosticsProviders = {
|
||||||
|
phpstan = {
|
||||||
|
config.cmd = getExe pkgs.phpstan;
|
||||||
|
};
|
||||||
|
};
|
||||||
in {
|
in {
|
||||||
options.vim.languages.php = {
|
options.vim.languages.php = {
|
||||||
enable = mkEnableOption "PHP language support";
|
enable = mkEnableOption "PHP language support";
|
||||||
|
|
@ -103,6 +111,21 @@ in {
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
extraDiagnostics = {
|
||||||
|
enable =
|
||||||
|
mkEnableOption "extra PHP diagnostics"
|
||||||
|
// {
|
||||||
|
default = config.vim.languages.enableExtraDiagnostics;
|
||||||
|
defaultText = literalExpression "config.vim.languages.enableExtraDiagnostic";
|
||||||
|
};
|
||||||
|
|
||||||
|
types = diagnostics {
|
||||||
|
langDesc = "PHP";
|
||||||
|
inherit diagnosticsProviders;
|
||||||
|
inherit defaultDiagnosticsProvider;
|
||||||
|
};
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
config = mkIf cfg.enable (mkMerge [
|
config = mkIf cfg.enable (mkMerge [
|
||||||
|
|
@ -154,5 +177,15 @@ in {
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
})
|
})
|
||||||
|
|
||||||
|
(mkIf cfg.extraDiagnostics.enable {
|
||||||
|
vim.diagnostics.nvim-lint = {
|
||||||
|
enable = true;
|
||||||
|
linters_by_ft.php = 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