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

The cider-error-hoover overlay gets applied to random logging statements in the REPL #3539

Closed
lassemaatta opened this issue Oct 18, 2023 · 4 comments · Fixed by #3540
Closed

Comments

@lassemaatta
Copy link

Expected behavior

Accidentally clicking on a line in the REPL should not open dired 😅

Actual behavior

The logging framework (com.taoensso/timbre) of our app logs stuff in the REPL. Sometimes, some subsegments of these log lines get the cider-error-hoover overlay. If you accidentally click on such line segment, a dired buffer opens in the project root folder.

Full line in the REPL:

DEBUG 2023-10-18 14:40:28.101 [962fe21b-a87d-4cfa-afc8-b64556de155d] [] [] lupapalvelu.perf-mon - /api/query/comments : 4 ms, 1 db calls took totally 2 ms

The section of the above line which acts as a link:

DEBUG 2023-10-18 14:40:28.101 [962fe21b-a87d-4cfa-afc8-b64556de155d] [] [] lupapalvelu.perf-mon - /api/query/comments : 4

In other words, the rest of the line ( ms, 1 db calls took totally 2 ms) does not get the overlay and does not act as a link.

The describe-text-properties on such a line segment produces.

Text content at position 67056:


There are 2 overlays here:
 From 67007 to 67128
  category             cider-error-hoover
  follow-link          mouse
  keymap               [Show]
  mouse-face           highlight
  pointer              hand
 From 67007 to 67162
  face                 hl-line
  priority             -50
  window               [Show]


There are text properties here:
  font-lock-face       cider-repl-stdout-face
  fontified            t
  help-echo            cider-locref-help-echo
  rear-nonsticky       (font-lock-face)

[back]

Steps to reproduce the problem

Hard to say. I think this might have something to do with the [] [] segment of the line. I think that this problem only affects lines which contain that part.

Environment & Version information

CIDER version information

;; CIDER 1.8.3-snapshot (package: 1.8.2), nREPL 1.1.0-alpha1
;; Clojure 1.10.3, Java 17.0.8.1

Lein / Clojure CLI version

Leiningen 2.10.0 on Java 17.0.8.1 OpenJDK 64-Bit Server VM

Emacs version

GNU Emacs 29.1.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.38, cairo version 1.18.0) of 2023-09-30

Operating system

Arch Linux

JDK distribution

openjdk version "17.0.8.1" 2023-08-24
OpenJDK Runtime Environment (build 17.0.8.1+1)
OpenJDK 64-Bit Server VM (build 17.0.8.1+1, mixed mode)
@vemv
Copy link
Member

vemv commented Oct 18, 2023

Thanks!

We haven't touched this area in quite a while I believe, so probably you have found a corner case.

Regardless, it's worth fixing and I'll be looking into it.

@vemv
Copy link
Member

vemv commented Oct 18, 2023

I fixed what I consider to be the main issue, namely that we could try jumping to non-existing files (mislead from bad regex matches)

For those cases we'll throw a (error) as usual for this section of the code. If it turns out to be annoying on click, LMK, although it shouldn't.

The regexes themselves are controlled by the cider-locref-regexp-alist. If you'd want the clicking to work, you'd need to tweak them. From our side it would seem rather low-prio at given that:

  • the regexes are fairly coarse-grained and therefore hard to maintain
  • even if we did a splendid work ourselves, user projects can always use a bespoke logging format, so our effort could easily be useless.

Cheers - V

@lassemaatta
Copy link
Author

Great, thanks!

If you'd want the clicking to work

Speaking for myself, I'd rather just disable the clicking. I often have the REPL buffer open and when switching back to emacs from e.g. the browser by clicking (yes, I use the mouse, please don't hate me) on the emacs window, I would often accidentally click on one of these overlay lines in the REPL which would a) move the focus to emacs, b) open dired, and c) leave me confused :)

@vemv
Copy link
Member

vemv commented Oct 18, 2023

You can always set cider-locref-regexp-alist to nil. Perhaps you'd want that only for remote projects - the clicking behavior seems generally useful.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants