Skip to content

Highlighting in REPL (performance) #78

@timlod

Description

@timlod

Hi,
I've been using emacs-tree-sitter for Python highlighting for a couple of months now, and am very happy with it - thanks!
I develop a lot with org-babel and emacs-jupyter, keeping an org-file and REPL open side-by-side, sending code back and forth.
I use the following to get tree-sitter highlighting in the REPL:

(add-to-list 'tree-sitter-major-mode-language-alist '(jupyter-repl-mode . python))
(add-to-list 'tree-sitter-major-mode-language-alist '(inferior-python-mode . python))
(add-hook 'tree-sitter-after-on-hook #'tree-sitter-hl-mode)

I notice that as the REPL buffer grows in length, everything slows down proportionally, the reason for which is tree-sitter. Obviously only a fraction of the output in the REPL is actually code that can be parsed and should be semantically highlighted (although I don't mind the highlighting that is produced even for output).

Occasionally clearing the buffer helps, but would there be an option to make this more performant?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions