Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

It should be possible to lint a portion of a buffer #3336

Open
Screwtapello opened this issue Feb 3, 2020 · 1 comment
Open

It should be possible to lint a portion of a buffer #3336

Screwtapello opened this issue Feb 3, 2020 · 1 comment

Comments

@Screwtapello
Copy link
Contributor

@Screwtapello Screwtapello commented Feb 3, 2020

In 82d99aa, the format command was split into format-selections and format-buffer (which selects the whole buffer then runs format-selections). I propose the same change for the lint command, splitting it into lint-selections and lint-buffer commands (with a lint alias for compatibility).

As well as linting part of a buffer, this allows different linters to be used on different parts of the buffer. In particular, it would allow shellcheck to check for portability problems in %sh{} blocks in Kakoune scripts.

I want to work on this, but before I get too far into it I figured I should file an issue so other people have a chance to say "no, that's a bad idea" or "make sure you keep in mind this particular thing".

@Screwtapello

This comment has been minimized.

Copy link
Contributor Author

@Screwtapello Screwtapello commented Feb 3, 2020

One thing I'm curious about: currently the linter has a line-specs option (line number and text) to store the flags for a given line, and a range-specs option (start line, start byte, end line, end byte, and text) to store the message for a given line. However, the lint-show command (that displays the tooltip for the current line) only ever uses the "start line" and "text" fields.

It'd be simpler to keep the lint messages in a line-specs option, but I worry whether some third-party scripts might be trying to use that information.

Screwtapello added a commit to Screwtapello/kakoune that referenced this issue Feb 5, 2020
Fixes mawww#3336.

Addresses parts of mawww#3254, mawww#3155, mawww#2302.

Changes include:

- New `lint-selections` command that only lints the current selections.
- New `lint-buffer` command that always lints the whole buffer.
- `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 added
  in commit ae339dc (2016) when we used `%~~` to quote messages.
  We stopped using `%~~` to quote messages 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.
- Hidden `lint_errors` option is now a line-specs, not range-specs,
  since we didn't use the other three coordinates, just the line number.
Screwtapello added a commit to Screwtapello/kakoune that referenced this issue Feb 7, 2020
Fixes mawww#3336.

Addresses parts of mawww#3254, mawww#3155, mawww#2302.

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 added
  in commit ae339dc (2016) when we used `%~~` to quote messages.
  We stopped using `%~~` to quote messages 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.
Screwtapello added a commit to Screwtapello/kakoune that referenced this issue Feb 7, 2020
Fixes mawww#3336.

Addresses parts of mawww#3254, mawww#3155, mawww#2302.

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 added
  in commit ae339dc (2016) when we used `%~~` to quote messages.
  We stopped using `%~~` to quote messages 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.
Screwtapello added a commit to Screwtapello/kakoune that referenced this issue Feb 7, 2020
Fixes mawww#2302, mawww#3336.

Addresses parts of mawww#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 added
  in commit ae339dc (2016) when we used `%~~` to quote messages.
  We stopped using `%~~` to quote messages 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.
Screwtapello added a commit to Screwtapello/kakoune that referenced this issue Feb 7, 2020
Fixes mawww#2302, mawww#3336.

Addresses parts of mawww#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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
1 participant
You can’t perform that action at this time.