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

Add ability to set end column and line on error #1400

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 3 additions & 1 deletion CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,10 @@
- Add ``flycheck-perl-module-list`` to use specified modules when
syntax checking code with the ``perl`` checker.
- Add ``flycheck-sh-bash-args`` to pass arguments to ``sh-bash`` [GH-1439].
- Add ``flychjeck-eslint-args`` to pass arguments to ``javascript-eslint``
- Add ``flychjeck-eslint-args`` to pass arguments to ``javascript-eslint``.
[GH-1360]
- Checkers can now specify the exact region covered by an error, either using
an end line and an end column, or using two buffer positions. [GH-1400]

- Improvements

Expand Down
10 changes: 5 additions & 5 deletions flycheck-ert.el
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ Defaults to `error'."
Like `with-temp-buffer', but resets the modification state of the
temporary buffer to make sure that it is properly killed even if
it has a backing file and is modified."
(declare (indent 0))
(declare (indent 0) (debug t))
`(with-temp-buffer
(unwind-protect
,(macroexp-progn body)
Expand All @@ -115,7 +115,7 @@ it has a backing file and is modified."

BODY is evaluated with `current-buffer' being a buffer with the
contents FILE-NAME."
(declare (indent 1))
(declare (indent 1) (debug t))
`(let ((file-name ,file-name))
(unless (file-exists-p file-name)
(error "%s does not exist" file-name))
Expand Down Expand Up @@ -347,12 +347,13 @@ ERROR is a Flycheck error object."
(overlay-get ov 'flycheck-error))
(flycheck-error-without-group error)))
(flycheck-overlays-in 0 (+ 1 (buffer-size)))))
(flycheck-highlighting-mode 'symbols)
(region
;; Overlays of errors from other files are on the first line
(if (flycheck-relevant-error-other-file-p error)
(cons (point-min)
(save-excursion (goto-char (point-min)) (point-at-eol)))
(flycheck-error-region-for-mode error 'symbols)))
(flycheck-error-region error)))
(level (flycheck-error-level error))
(category (flycheck-error-level-overlay-category level))
(face (get category 'face))
Expand Down Expand Up @@ -460,8 +461,7 @@ resource directory."
Return non-nil if the point is at the N'th Flycheck error in the
current buffer. Otherwise return nil."
(let* ((error (nth (1- n) flycheck-current-errors))
(mode flycheck-highlighting-mode)
(region (flycheck-error-region-for-mode error mode)))
(region (flycheck-error-region error)))
(and (member error (flycheck-overlay-errors-at (point)))
(= (point) (car region)))))

Expand Down