neovim: Add java snippets for checks

This commit is contained in:
Simon Bruder 2023-06-02 13:12:10 +02:00
parent ef2ec9d975
commit 694616fcc0
Signed by: simon
GPG key ID: 8D3C82F9F309F8EC

View file

@ -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 cant be empty");
}$0'';
CheckNull = mkSnippet "chkn" "Check for null" ''
if (''${1:var} == null) {
throw new NullPointerException("$1 cant 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" ];