Three new files provide custom completers for import statements; javaClassHierarchy.kak, javaInterfaceHierarchy.kak, javaAnnotationEnumHierarchy.kak
- Hierarchy For All Packages for import statements.
Usage Completers
import<space>object<tab>
import java.lang.Object;
import<space>basicfileattributeview<tab>
import java.nio.file.attribute.BasicFileAttributeView;
References
- Oracle 2021, Hierarchy For All Packages, Java SE 15, viewed 29 January 2021, Class Hierarchy (Java SE 15 & JDK 15)
- Screwtape 2020, Intro to Kakoune completers, Discuss Kakoune, viewed 29 January 2021, Intro to Kakoune completers
- Screwtape 2020, Intro to Kakoune completions, Screwtape’s Notepad, viewed 29 January 2021, https://zork.net/~st/jottings/Intro_to_Kakoune_completions.html
Completers
The scaffolding for custom completions @Screwtapello and community any improvements you can see are welcome (awk was necessary due to hang/parse-time).
Small additional benefit is a list of unknown/unfamiliar or what was it again? Close match imports that can be reviewed or copied onto system clipboard and pasted into the java api search field to read the documentation. https://docs.oracle.com/en/java/javase/15/docs/api/index.html
import file
hook global WinSetOption filetype=java %{
require-module java
declare-option -hidden completions java_annotation_enum_hierarchy_completions
set-option window completers option=java_annotation_enum_hierarchy_completions %opt{completers}
hook -group java-import-statements window InsertIdle .* %{
try %{
execute-keys -draft 2b s \A^import<space>\z<ret>
evaluate-commands -draft %{
execute-keys h <a-i>w <a-semicolon>
set-option window java_annotation_enum_hierarchy_completions \
"%val{cursor_line}.%val{cursor_column}+%val{selection_length}@%val{timestamp}"
}
evaluate-commands %sh{
exec awk -f - <<'EOF'
BEGIN {
split("java.beans.BeanProperty java.beans.ConstructorProperties ...", annotationTypeHierarchy);
}
function print_import_statement(imports) { for (i in imports) { printf(" %s\\;||%s", imports[i], imports[i]); } }
BEGIN {
printf("set-option -add window java_annotation_enum_hierarchy_completions ");
print_import_statement(annotationTypeHierarchy);
printf("\n");
}
EOF
}
} catch %{
set-option window java_annotation_enum_hierarchy_completions
}
}
hook -once -always window WinSetOption filetype=.* %{ remove-hooks window java-import-statements }
}
EXPLICIT LANGUAGE WARNING on Spotify:
This Is The New Sht | Marilyn Manson or youtube.
Thanks guys. Bye .