Commit Graph

19 Commits

Author SHA1 Message Date
Frank LENORMAND
b4f2c3fe91 rc lint: Remove the concept of "enabling" linting
This commit renames `lint-enable` into `lint-show-diagnostics`,
makes it hidden, and calls it automatically after diagnostics have
been recovered by `:lint-cleaned-selections`.

The `lint-disable` command becomes `lint-hide-diagnostics`.

The concept of "enabling" diagnostics was inherited from the Clang
support script, but in that case it's not clear why calling `:lint`
should do the work but not render it (similarly to `:spell`).

The `lint-show` command was also renamed into a more descriptive
`lint-show-current-line`.
2020-05-29 14:39:39 +03:00
Frank LENORMAND
7d987c013e rc lint: Check the lintcmd option is set in :lint-buffer
Calling `:lint-buffer` when `lintcmd` is empty results in a temporary
directory being created, but never removed when the underlying linting
code errors out.
2020-03-27 10:20:40 +03:00
Jason Felice
1ed8b84762 Fix unnecessary refreshes
Incrementally setting the lint variables triggers multiple refreshes,
including the text jumping as the guttter column is removed and re-
added.  This causes the info message to disappear when linting is done
on NormalIdle.
2020-02-28 21:44:10 -05:00
Tim Allen
9277121695 rc lint: Change flag symbols for lint errors and warnings.
As suggested in code review.
2020-02-14 17:27:36 +11:00
Tim Allen
59e273c316 rc lint: Teach lint-{next,previous}-message to wrap around the buffer.
This matches the behaviour of make-{next,previous}-error.
2020-02-13 20:27:28 +11:00
Tim Allen
48bd7387bb rc lint: When parsing lint messages, use "remove shortest prefix" pattern.
There might legitimately be "|" characters in the message, so
we want to stop at the first one, the one that delimits the message location
from the message text.
2020-02-13 20:27:24 +11:00
Tim Allen
cad0572ca5 rc lint: Re-add missing kakquote functions. 2020-02-13 20:27:19 +11:00
Tim Allen
c1e9f46301 rc lint: Don't start a comment with "shellcheck".
That confuses shellcheck into expecting a warning pragma.
2020-02-13 20:27:12 +11:00
Tim Allen
09f067d585 rc lint: More code-review comments.
Don't ask Kakoune to quote values we know can never contain shell-sensitive
characters, and flatten the kakquote() function to a single line for ease
of copy/pasting.
2020-02-09 14:01:35 +11:00
Tim Allen
673d081823 rc lint: Address code-review comments. 2020-02-09 13:23:58 +11:00
Tim Allen
51fcea7ce0 rc lint: Add a lint-selections command to lint part of a buffer.
Fixes #2302, #3336.

Addresses parts of #3155.

Changes include:

- New `lint-selections` command that only lints the current selections,
  and allows a custom lint command.
- New `lint-buffer` command that always lints the whole buffer with
  the linter specified in the lintcmd option.
- `lint` alias for `lint-buffer`, for backwards compatibility.
- Errors and warnings are now shown in the Error and Information faces,
  not hard-coded red and yellow.
- Error and warning flags now use "!" and "?" symbols respectively,
  instead of a unicode block, so they can still be distinguished
  in a monochrome colour-scheme or by colour-blind users.
- An error flag on a given line always takes precedence over a warning.
- All messages for the same line are collected into a multi-line message.
- We no longer escape tildes in messages, since that change was added
  in commit ae339dc (2016) when we started using `%~~` to quote messages.
  We stopped using `%~~` in commit 1a2eecd (2018).
- Anything the linter writes to stderr is logged to the *debug* buffer,
  not lost.
- If the linter writes to stderr, an error is shown to the user instead
  of the usual error/warning count.
- The `lint_errors` hidden option is replaced by `lint_messages`,
  because it contains warnings as well as errors.
- `lint-next-error` renamed to `lint-next-message`,
  and `lint-previous-error` renamed to `lint-previous-message`
  for the same reason.
    - New `lint-next-error` and `lint-previous-error` aliases,
      for backwards compatibility.
- `lint-next-message` and `lint-previous-message` show the message
  they jump to.
- Where `lint_errors` was a range-specs option, `lint_messages` is a
  line-specs option to keep things simpler. This means lint-next-message
  and lint-previous-message no longer jump to a specific column.
2020-02-07 19:22:47 +11:00
Frank LENORMAND
275abb227e rc: Make docstrings more readable
This cosmetics commit makes use of the auto-deindentation syntax,
available to docstrings.
2020-02-03 20:53:28 +01:00
Frank LENORMAND
5b1f9255a1 rc: Use the standard fail command to report errors
Merely using `echo` with markup doesn't log errors in the debug
buffers, and is also less readable.
2019-11-14 08:32:55 +01:00
Maxime Coste
6ee71191af Merge remote-tracking branch 'codesoap/background_blocks' 2019-09-15 09:29:26 +10:00
Maxime Coste
4b7b5d077c Make quoting opt-in by using $kak_quoted_... 2019-06-23 12:04:21 +10:00
codesoap
683c7c1fa5 Fix fifos for Linux
Those were accidentaly broken while fixing for OpenBSD.
2019-06-10 18:25:51 +02:00
codesoap
009eb80ca0 Fix tools using fifos for OpenBSD
Without these changes, kak would hang on the corresponding commands,
displaying a 'waiting for shell command to finish' message.
2019-06-09 11:50:35 +02:00
James Thomas
5537645ea5 changes the name of a buffer being linted from /tmp/kak-lint.XXXXXX/buf.$extension to /tmp/kak-lint.XXXXXX/$filename. This allows the linter to compile Java files, which fail to compile if the Class name does not match the File name being linted. 2019-05-23 15:52:57 -04:00
Alex Leferry 2
c0dccdd90d Add categories in rc/
Closes #2783
2019-03-21 01:06:16 +01:00