mirror of
https://github.com/vale981/emacs-jupyter
synced 2025-03-05 07:41:37 -05:00
Enable syntax highlighting when using js2-mode
with an IJavascript REPL
This commit is contained in:
parent
e654487b2a
commit
5fd7ccf74f
1 changed files with 15 additions and 1 deletions
|
@ -1980,7 +1980,21 @@ call the function `font-lock-mode'."
|
|||
(unless (get-text-property
|
||||
(nth 8 state) 'font-lock-face)
|
||||
(when sff (funcall sff state)))))))))
|
||||
(font-lock-mode)))
|
||||
(font-lock-mode)
|
||||
;; Special case since `js2-mode' does not use `font-lock-defaults' for
|
||||
;; highlighting.
|
||||
(when (and (eq jupyter-repl-lang-mode 'js2-mode)
|
||||
(null (nth 0 font-lock-defaults)))
|
||||
(add-hook 'after-change-functions
|
||||
(lambda (beg end len)
|
||||
(unless (jupyter-repl-cell-finalized-p)
|
||||
(save-restriction
|
||||
(narrow-to-region
|
||||
(jupyter-repl-cell-code-beginning-position)
|
||||
(jupyter-repl-cell-code-end-position))
|
||||
(js2-parse)
|
||||
(js2-mode-apply-deferred-properties))))
|
||||
t t))))
|
||||
|
||||
(defun jupyter-repl-insert-banner (banner)
|
||||
"Insert BANNER into the `current-buffer'.
|
||||
|
|
Loading…
Add table
Reference in a new issue