kakoune: add dhall-lsp support

This commit is contained in:
Timothy DeHerrera 2020-12-27 17:38:22 -07:00
parent fd3d0abd05
commit 8842ae52a0
No known key found for this signature in database
GPG Key ID: 8985725DB5B0C122
5 changed files with 16 additions and 23 deletions

View File

@ -11,9 +11,17 @@
rustup
nix-linter
dhall
dhall-lsp-server
];
environment.etc = {
"xdg/kak-lsp/kak-lsp.toml".text = ''
${builtins.readFile "${pkgs.kak-lsp.src}/kak-lsp.toml"}
[language.dhall]
filetypes = ["dhall"]
roots = [".git"]
command = "dhall-lsp-server"
'';
"xdg/kak/kakrc".source = ./kakrc;
"xdg/kak/autoload/plugins".source = ./plugins;
"xdg/kak/autoload/lint".source = ./lint;

View File

@ -1,9 +0,0 @@
hook -group lint global WinSetOption filetype=dhall %{
set buffer lintcmd '/etc/xdg/kak/autoload/lint/dhall.sh $1'
lint-enable
set buffer formatcmd "dhall format"
hook buffer BufWritePre .* %{
format
lint
}
}

View File

@ -1,13 +0,0 @@
#!/usr/bin/env zsh
dhall lint --inplace $1 2>&1 | < /dev/stdin > /tmp/lint.out
if head -2 /tmp/lint.out | grep Error &> /dev/null; then
sed -n 4p /tmp/lint.out | tr '\n' ' '
sed -n 2p /tmp/lint.out | tr 'E' 'e' | tr '\n' ';' \
| sed -r "s/\x1B\[([0-9]{1,2}(;[0-9]{1,2})?)?[m|K]//g"
awk 'NR>7 {printf " %s", $0}' /tmp/lint.out
else
true
fi
rm -f /tmp/lint.out

View File

@ -1,5 +1,5 @@
eval %sh{kak-lsp --kakoune -s $kak_session}
hook -group lsp global WinSetOption filetype=(elm|rust|c|cpp|python) %{
hook -group lsp global WinSetOption filetype=(elm|rust|c|cpp|python|dhall) %{
lsp-auto-hover-enable
# easily enter lsp mode
@ -7,4 +7,8 @@ hook -group lsp global WinSetOption filetype=(elm|rust|c|cpp|python) %{
set buffer lsp_hover_anchor true
set buffer lsp_auto_highlight_references true
hook buffer BufWritePre .* %{
lsp-formatting
}
}

View File

@ -0,0 +1,3 @@
hook -group lsp global WinSetOption filetype=dhall %{
lsp-enable-window
}