Diff
1diff --git a/plugins/qodana/README.md b/plugins/qodana/README.md
2new file mode 100644
3index 0000000000000000000000000000000000000000..0b68bdecfb9c9e541e959b85c738b062c59dde1f
4--- /dev/null
5+++ b/plugins/qodana/README.md
6@@ -0,0 +1,20 @@
7+# JetBrains Qodana CLI plugin
8+
9+This plugin adds completion for the [JetBrains Qodana CLI](https://github.com/JetBrains/qodana-cli).
10+
11+To use it, add `qodana` to the plugins array in your zshrc file:
12+
13+```zsh
14+plugins=(... qodana)
15+```
16+
17+This plugin does not add any aliases.
18+
19+## Cache
20+
21+This plugin caches the completion script and is automatically updated when the
22+plugin is loaded, which is usually when you start up a new terminal emulator.
23+
24+The cache is stored at:
25+
26+- `$ZSH_CACHE_DIR/completions/_qodana` completions script
27diff --git a/plugins/qodana/qodana.plugin.zsh b/plugins/qodana/qodana.plugin.zsh
28new file mode 100644
29index 0000000000000000000000000000000000000000..2b92a8051a74c5558c1760a14d5639ed3ad3f21b
30--- /dev/null
31+++ b/plugins/qodana/qodana.plugin.zsh
32@@ -0,0 +1,14 @@
33+# Autocompletion for the JetBrains Qodana CLI (qodana).
34+if (( ! $+commands[qodana] )); then
35+ return
36+fi
37+
38+# If the completion file doesn't exist yet, we need to autoload it and
39+# bind it to `qodana`. Otherwise, compinit will have already done that.
40+if [[ ! -f "$ZSH_CACHE_DIR/completions/_qodana" ]]; then
41+ typeset -g -A _comps
42+ autoload -Uz _qodana
43+ _comps[qodana]=_qodana
44+fi
45+
46+qodana completion zsh >| "$ZSH_CACHE_DIR/completions/_qodana" &|