Open deb75 opened 3 years ago
Any hints ?
Is there a way to jump to the line in corresponding file which produced the logging message just by clicking on the logging message ? It is possible with exception message but it seems due to the comint
mode according to my (very poor) understanding.
Regards
Hi,
I finally ended up writing some functions to do it :
(defun logjump/select-inside-paren ()
(let (p1 p2)
(skip-chars-backward "^(")
(setq p1 (point))
(skip-chars-forward "^)")
(setq p2 (point))
(buffer-substring-no-properties p1 p2)))
(defun logjump/open-file-at-line ()
(interactive)
(let (s l lineno filepath p)
(setq p (point))
(setq s (logjump/select-inside-paren))
(setq l (split-string s ":"))
(setq lineno (string-to-number (nth 1 l)))
(setq filepath (car (directory-files-recursively (expand-file-name "src" (projectile-project-root)) (car l))))
(if (< (length (window-list)) 2)
(split-window-below))
(other-window 1)
(find-file filepath)
(goto-line lineno)
(other-window -1)
(goto-char p)))
(add-hook 'dap-server-log-mode (lambda() (local-set-key [f5] 'logjump/open-file-at-line)))
The last line with the hook is currently not working. When dap-java
opens a server log buffer, it should set a local key,
but I have to do it manually.
The function takes the log line below the point and looks for the pattern "(filename:34)". Then, it uses the projectile project root and assumes sources are in "src" subfolder. I did that to avoid searching everywhere when the project directory tree is large.
I would like to perform some enhancements :
fd-find
which works on both linux and windowsbut I do not really know the way to go
Any hints ?
Regards
Hello,
I noticed that when some exceptions are raised and displayed in the
dab-debug
buffer like this :I am able to jump on the place where the exception has been thrown by clicking on the line "at ..."
I wonder if this could be possible with log messages which appears like this :
When I click on it,
emacs
reacts with :Is there a way of configuring
lsp-java
or/and the log messages format so thatlsp-java
is able to jump on the place where the log message is emitted ?Regards