doomemacs / doomemacs/core

Node.js compilation stack traces are not properly parsed through compilation-error-regexp-alist

Open
#8,229 0 comments 0 reactions 0 assignees View on GitHub
is:bug needs-triage
Dominant language
Emacs Lisp
Stars
22.7k
Forks
3.1k
Avg merge
10h 46m
Merged PRs (30d)
4

Description

### I confirm that...

- [x] I have searched the [issue tracker](https://github.com/doomemacs/doomemacs/issues), [documentation](https://docs.doomemacs.org), [FAQ](https://docs.doomemacs.org/-/faq), [Discourse](https://discourse.doomemacs.org), and [Google](https://google.com), in case this issue has already been reported/resolved.

- [x] I have read "[How to Debug Issues](https://doomemacs.org/d/how2debug)", and will use it to provide as much information about this issue as possible.

- [x] The issue can be reproduced on the **latest** available commit of Doom.

- [x] The issue can be reproduced on a stable release of Emacs, such as 27, 28, or 29. *(Unstable versions end in .50, .60, or .9x)*

### Expected behavior

Running a Node.js project, such as with `projectile-run-project`, and trying to open error locations inside of stack traces leads to the errors with line and column numbers to be highlighted and interpreted properly. Actions such as clicking on the error, placing the cursor on top of it and pressing enter, executing `M-x previous-error`, `M-x next-error`... will jump immediately to the place referenced by the error.

### Current behavior

Node.js errors are not properly parsed and line and column number are not properly read, because no Node.js specific regex is part of `compilation-error-regexp-alist`. Instead, `compilation-mode` seems to fall back to a different regex that only expects line numbers and no column numbers, leading to line numbers mistakenly being part of the file path. Thus, when they are clicked or the cursor is placed on top of them and Enter is hit, it is not possible to jump to the error's location.

![Image](https://github.com/user-attachments/assets/933ae2b6-59d7-4453-b210-53d302392086)

Though, the section
https://github.com/doomemacs/doomemacs/blob/master/modules/lang/javascript/config.el#L48-L52
where the parsing regex supposedly is activated after RJSX-Mode is loaded,
suggests that the `:javascript` module intends this feature to work.

The problem now lies in the package symbol `compilation`, which does nothing. The compilation module is named compile.el, thus `compile` needs to be used.
If `compilation` is replaced with `compile` in the referenced code snippet and it is placed as a workaround i. e. in config.el,

```elisp
(after! compile
(add-to-list 'compilation-error-regexp-alist 'node)
(add-to-list 'compilation-error-regexp-alist-alist
'(node "^[[:blank:]]*at \\(.*(\\|\\)\\(.+?\\):\\([[:digit:]]+\\):\\([[:digit:]]+\\)"
2 3 4)))
```

the compilation mode buffer works as intended, because line and column numbers are properly parsed and highlighted:

![Image](https://github.com/user-attachments/assets/085a5bff-3d8c-48f6-959f-d90821b1d3a8)

### Steps to reproduce

1. Activate the `:javascript` module in init.el
2. Close emacs
3. Execute `doom sync` so that the `:javascript` module is installed
4. open Emacs with a Javascript or Typescript file,
5. Run a Node.js project that throws errors
6. Alternatively to 4 and 5: open a text file containing a node.js error output, enter `M-x rjsx-mode` and then do `M-x compilation-mode`

### System Information

https://pastebin.com/GQRGcGRq

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.