Address code-review comments

- some wording changes in included documentation
- find supports multiple starting paths, we don't need to launch it 3 times
- Change the regex that trims the file extension to only trim the last extension

Some additional things I noticed:

- find should use -L to see through symlinks like the autoload processing does.
- find should check the user's autoload directory first, so users can override
  Kakoune's built-in documentation.
This commit is contained in:
Tim Allen 2020-09-03 15:06:24 +10:00
parent d628cb50cf
commit e3298c6320
3 changed files with 26 additions and 24 deletions

View File

@ -10,6 +10,6 @@
== Options
*docsclient* (str)::
If set, the `:doc` command (and other commands that display documentation)
will try to display documentation in the Kakoune client with this name.
If set, the `:doc` command will try to display documentation in the Kakoune
client with this name.
See <<commands#clients-and-sessions,`:doc commands clients-and-sessions`>>

View File

@ -137,18 +137,20 @@ define-command -params 1 -hidden doc-render %{
define-command -params 1..2 \
-shell-script-candidates %{
if [ "$kak_token_to_complete" -eq 0 ]; then
(
find "${kak_runtime}/doc/" -type f -name "*.asciidoc"
find "${kak_runtime}/rc/" -type f -name "*.asciidoc"
find "${kak_config}/autoload/" -type f -name "*.asciidoc"
) | sed 's,.*/,,; s/\.[^/]*$//'
find -L \
"${kak_config}/autoload/" \
"${kak_runtime}/doc/" \
"${kak_runtime}/rc/" \
-type f -name "*.asciidoc" |
sed 's,.*/,,; s/\.[^.]*$//'
elif [ "$kak_token_to_complete" -eq 1 ]; then
page=$(
(
find "${kak_runtime}/doc/" -type f -name "$1.asciidoc"
find "${kak_runtime}/rc/" -type f -name "$1.asciidoc"
find "${kak_config}/autoload/" -type f -name "$1.asciidoc"
) | head -1
find -L \
"${kak_config}/autoload/" \
"${kak_runtime}/doc/" \
"${kak_runtime}/rc/" \
-type f -name "$1.asciidoc" |
head -1
)
if [ -f "${page}" ]; then
awk '
@ -164,11 +166,12 @@ define-command -params 1..2 \
} %{
evaluate-commands %sh{
page=$(
(
find "${kak_runtime}/doc/" -type f -name "$1.asciidoc"
find "${kak_runtime}/rc/" -type f -name "$1.asciidoc"
find "${kak_config}/autoload/" -type f -name "$1.asciidoc"
) | head -1
find -L \
"${kak_config}/autoload/" \
"${kak_runtime}/doc/" \
"${kak_runtime}/rc/" \
-type f -name "$1.asciidoc" |
head -1
)
if [ -f "${page}" ]; then
jump_cmd=""

View File

@ -1,8 +1,8 @@
= Integrate with tools that check files for problems.
Many file-formats have "lint" tools that check for common problems and point out
where they occur. Most of these tools produce output in the the traditional
message format:
where they occur. Most of these tools produce output in the traditional message
format:
----
{filename}:{line}:{column}: {kind}: {message}
@ -15,7 +15,7 @@ This plugin can run such tools and collect the resulting messages. The complete
output is collected in the `*lint-output*` buffer, and any lines in the current
file with messages will have a marker displayed next to them in the left margin.
When the cursor moves onto a line with the problem, the associated messages will
be displayed in a tool tip..
be displayed in a tool tip.
== Commands
@ -46,12 +46,11 @@ be displayed in a tool tip..
The shell command used by lint-buffer and lint-selections.
+
It will be given the path to a file containing the text to be
linted, and must produce output in the format:
linted, and must produce output in the format described above.
*toolsclient* (str)::
If set, the `:lint` command (and other commands that point out files and
line-numbers) will try to display its results in the Kakoune client with
this name.
If set, the `:lint` command will try to display its results in the Kakoune
client with this name.
See <<commands#clients-and-sessions,`:doc commands clients-and-sessions`>>