I am using editing JavaScript in Emacs using the Javascript-IDE major mode.

This is what I have in my .emacs file:

(use-package js2-mode
  :mode "\\.jsx?\\'" 
  (setq js2-highlight-level 3) 
  (add-hook 'js2-mode-hook (lambda () (progn (auto-revert-mode)
                                         (setq auto-revert-interval 0.1))))
  :ensure t)

Here's an excerpt from an actual screenshot:

enter image description here

The variable x pointed to by the red arrow is a syntax error. Unfortunately the same color is also chosen for variable rv (pointed to by the green arrow) which is not a syntax error. The syntax error is indeed detected as when I place the cursor over x I see in the mini-buffer:

Undeclared variable or function 'x'

How can I make the syntax errors more conspicuous by means of color, boldness or underlining ? To draw visual attention I was thinking maybe red on white background (for added contrast) but I have no idea how to achieve that.

  • 1
    js2-modes error checking is limited in scope. You are much better of using tide or lsp-javascript with a combination for flycheck for error checking for javascript files – Chakravarthy Raghunandan Jun 28 '18 at 16:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.