protesilaos / modus-themes

Highly accessible themes for GNU Emacs, conforming with the highest standard for colour contrast between background and foreground values (WCAG AAA).
https://protesilaos.com/emacs/modus-themes
GNU General Public License v3.0
526 stars 29 forks source link

Treesitter mode support #100

Closed rosstimson closed 4 months ago

rosstimson commented 4 months ago

Thank you for your Emacs packages, I use few of them.

Not sure if directly related to the theme or not but when I've switched to using Treesitter modes I lose most of the syntax colouring.

python-mode

python-mode

python-ts-mode

python-ts-mode

protesilaos commented 4 months ago

From: Ross Timson @.***> Date: Sun, 10 Mar 2024 12:07:20 -0700

Thank you for your Emacs packages, I use few of them.

You are welcome!

Not sure if directly related to the theme or not but when I've switched to using Treesitter modes I lose most of the syntax colouring.

Are you using the built-in tree-sitter implementation of Emacs 29? My understanding is that the major-mode should implement the face mapping. All the new faces for tree-sitter are designed to inherit from existing ones, so you should be getting colours there.

-- Protesilaos Stavrou https://protesilaos.com

rosstimson commented 4 months ago

Sorry, I should've said, I'm on Emacs 29.2.

Yeah, it's just the built in python-ts-mode, if I show the active major mode then jump to the file the header looks like:

;;; python.el --- Python's flying circus support for Emacs -*- lexical-binding: t -*-

;; Copyright (C) 2003-2024 Free Software Foundation, Inc.

;; Author: Fabián E. Gallina <fgallina@gnu.org>
;; URL: https://github.com/fgallina/python.el
;; Version: 0.28
;; Package-Requires: ((emacs "24.4") (compat "28.1.2.1") (seq "2.23"))
;; Maintainer: emacs-devel@gnu.org
;; Created: Jul 2010
;; Keywords: languages

I've just tried running describe-char when the point is on one of the imports:

python-mode

There is an overlay here:
 From 54 to 69
  face                 hl-line
  priority             -50
  window               #<window 3 on website.py>

There are text properties here:
  face                 font-lock-keyword-face
  fontified            t

python-ts-mode

There is an overlay here:
 From 54 to 69
  face                 hl-line
  priority             -50
  window               #<window 3 on website.py>

There are text properties here:
  fontified            t

So to my uneducated eyes this looks like it may be an issue with python-ts-mode rather than the theme. I should've worked out how to show this before submitting the issue.

Hope this helps.

protesilaos commented 4 months ago

From: Ross Timson @.***> Date: Mon, 11 Mar 2024 14:41:44 -0700

[... 50 lines elided]

So to my uneducated eyes this looks like it may be an issue with python-ts-mode rather than the theme. I should've worked out how to show this before submitting the issue.

Indeed, this is an issue with the major mode. Notice how the first describe-char tells you that the character has a face associated with it. This means that the major mode has the necessary setup to style those accordingly. Whereas the tree-sitter mode does not have any face there.

Have you ever tried M-x report-emacs-bug? It lets you prepare an email and send it to the Emacs maintainers. Even if you do not have email set up in Emacs, you can copy that buffer into your email client and take it from there.

If you do send a bug report, you are welcome to include me in CC. Use my email @.***>.

Hope this helps.

Yes, it does. Thank you for taking the time to do it!

-- Protesilaos Stavrou https://protesilaos.com

rosstimson commented 4 months ago

Thanks, I'll look into doing that over the next couple days.