neovim: Add java snippets for checks
This commit is contained in:
parent
ef2ec9d975
commit
694616fcc0
|
@ -64,12 +64,23 @@ let
|
||||||
MultiplicationSign = mkSnippet' "·" "Insert multiplication sign" ''\cdot $0'' { autotrigger = true; };
|
MultiplicationSign = mkSnippet' "·" "Insert multiplication sign" ''\cdot $0'' { autotrigger = true; };
|
||||||
Fraction = mkSnippet' "//" "Fraction" ''\frac{$1}{$2}$0'' { autotrigger = true; };
|
Fraction = mkSnippet' "//" "Fraction" ''\frac{$1}{$2}$0'' { autotrigger = true; };
|
||||||
};
|
};
|
||||||
|
java = {
|
||||||
|
CheckEmptyString = mkSnippet "chke" "Check for empty string" ''
|
||||||
|
if (''${1:var}.isEmpty()) {
|
||||||
|
throw new IllegalArgumentException("$1 can’t be empty");
|
||||||
|
}$0'';
|
||||||
|
CheckNull = mkSnippet "chkn" "Check for null" ''
|
||||||
|
if (''${1:var} == null) {
|
||||||
|
throw new NullPointerException("$1 can’t be null");
|
||||||
|
}$0'';
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
snippetsIndex = pkgs.writeTextDir "package.json" (builtins.toJSON {
|
snippetsIndex = pkgs.writeTextDir "package.json" (builtins.toJSON {
|
||||||
contributes.snippets = lib.mapAttrs
|
contributes.snippets = lib.mapAttrs
|
||||||
(id: language: { inherit language; path = "./snippets/${id}.json"; })
|
(id: language: { inherit language; path = "./snippets/${id}.json"; })
|
||||||
{
|
{
|
||||||
|
java = [ "java" ];
|
||||||
nix = [ "nix" ];
|
nix = [ "nix" ];
|
||||||
rust = [ "rust" ];
|
rust = [ "rust" ];
|
||||||
tex = [ "tex" ];
|
tex = [ "tex" ];
|
||||||
|
|
Loading…
Reference in a new issue