Merge remote-tracking branch 'kurkale6ka/lint_explicit'
This commit is contained in:
commit
9ca0467c4d
|
@ -23,7 +23,7 @@ def lint -docstring 'Parse the current buffer with a linter' %{
|
|||
|
||||
{ # do the parsing in the background and when ready send to the session
|
||||
|
||||
eval "$kak_opt_lintcmd '$dir'/buf" | sort -t: -k2 -n > "$dir"/stderr
|
||||
eval "$kak_opt_lintcmd '$dir'/buf" | sort -t: -k2,2 -n > "$dir"/stderr
|
||||
printf '%s\n' "eval -client $kak_client echo 'linting done'" | kak -p "$kak_session"
|
||||
|
||||
# Flags for the gutter:
|
||||
|
@ -48,7 +48,9 @@ def lint -docstring 'Parse the current buffer with a linter' %{
|
|||
}
|
||||
END {
|
||||
print "set \"buffer=" file "\" lint_flags %{" stamp ":" substr(flags, 1, length(flags)-1) "}"
|
||||
print "set \"buffer=" file "\" lint_errors %{" substr(errors, 1, length(errors)-1) "}"
|
||||
errors = substr(errors, 1, length(errors)-1)
|
||||
gsub("~", "\\~", errors)
|
||||
print "set \"buffer=" file "\" lint_errors %~" errors "~"
|
||||
}
|
||||
' "$dir"/stderr | kak -p "$kak_session"
|
||||
|
||||
|
@ -68,7 +70,6 @@ def -hidden lint-show %{ %sh{
|
|||
def lint-enable -docstring "Activate automatic diagnostics of the code" %{
|
||||
addhl flag_lines default lint_flags
|
||||
hook window -group lint-diagnostics NormalIdle .* %{ lint-show }
|
||||
hook window -group lint-diagnostics WinSetOption ^lint_errors=.* %{ info; lint-show }
|
||||
}
|
||||
|
||||
def lint-disable -docstring "Disable automatic diagnostics of the code" %{
|
||||
|
@ -98,3 +99,26 @@ def lint-next -docstring "Jump to the next line that contains an error" %{ %sh{
|
|||
printf '%s\n' "select $candidate.$col,$candidate.$col"
|
||||
}
|
||||
}}
|
||||
|
||||
def lint-prev -docstring "Jump to the previous line that contains an error" %{ %sh{
|
||||
printf '%s\n' "$kak_opt_lint_errors" | sort -t, -k1,1 -rn | {
|
||||
while read -r line
|
||||
do
|
||||
coords=$(printf %s "$line" | cut -d, -f1,2)
|
||||
candidate="${coords%,*}"
|
||||
if [ "$candidate" -lt "$kak_cursor_line" ]
|
||||
then
|
||||
break
|
||||
fi
|
||||
done
|
||||
if [ "$candidate" -lt "$kak_cursor_line" ]
|
||||
then
|
||||
col="${coords#*,}"
|
||||
else
|
||||
last=$(printf '%s\n' "$kak_opt_lint_errors" | tail -n1)
|
||||
candidate=$(printf '%s\n' "$last" | cut -d, -f1)
|
||||
col=$(printf '%s\n' "$last" | cut -d, -f2)
|
||||
fi
|
||||
printf '%s\n' "select $candidate.$col,$candidate.$col"
|
||||
}
|
||||
}}
|
||||
|
|
Loading…
Reference in New Issue
Block a user