all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#68233: 29.1; tree-sitter-hl-mode doesn't honor the :extend font face in single line comments
@ 2024-01-03  3:33 Michael Labbé
  2024-01-03 17:50 ` Eli Zaretskii
  0 siblings, 1 reply; 2+ messages in thread
From: Michael Labbé @ 2024-01-03  3:33 UTC (permalink / raw)
  To: 68233

[-- Attachment #1: Type: text/plain, Size: 6218 bytes --]

== BEGIN DESCRIPTION ==

In many, if not all supported languages, tree-sitter-hl-mode's font locking does not honor the `:extend` attribute of a face.  The [:extend face attribute](https://www.gnu.org/software/emacs/manual/html_node/elisp/Face-Attributes.html) is used to send a highlight past the newline character in a line.

The easiest way to see this is to produce a `//` comment in a mode that supports it, such as c-mode.  Set the `font-lock-comment-face` and `tree-sitter-hl-face:comment` `:background` to a color other than the default background.  Then, observe as comments stop at the newline instead of the end of the frame.

To reproduce this issue:

1.  launch emacs 29.1 with `emacs -q --load repro.el` (code is below). 
2. Create a blank c file, ensuring c-mode is set. Add a `//` comment to any line and hit enter.
3. Observe the comment terminates at the newline (before the right side of the frame).
4. Type `M-x` `tree-sitter-hl-mode`.  Observe the comment goes to the right side of the frame.

## Languages this bug exists in ##

Not a complete list, but:
- c
- c++
- javascript
- rust (via rustic)
- bash
- python
- ruby 
 
# repro.el #
```
;;
;; repro.el

(custom-set-faces
'(font-lock-comment-face ((t (:background "darkblue" :foreground "yellow" :extend t)))))

(custom-set-faces
'(tree-sitter-hl-face:comment ((t (:inherit font-lock-comment-face)))))

;; comments look like this

;;
;; tree-sitter
;;

(defvar bootstrap-version)
(setq straight-repository-branch "master")
(let ((bootstrap-file
       (expand-file-name "straight/repos/straight.el/bootstrap.el" user-emacs-directory))
      (bootstrap-version 6))
  (unless (file-exists-p bootstrap-file)
    (with-current-buffer
        (url-retrieve-synchronously
         "https://raw.githubusercontent.com/radian-software/straight.el/develop/install.el"
         'silent 'inhibit-cookies)
      (goto-char (point-max))
      (eval-print-last-sexp)))
  (load bootstrap-file nil 'nomessage))

(require 'package)
(use-package tree-sitter
    :straight t
    :config
    (global-tree-sitter-mode)
    :hook ((python-mode
            rustic-mode
            c-mode cc-mode
            go-mode
            typescript-mode
            javascript-mode) . tree-sitter-hl-mode)
    )
    
(use-package tree-sitter-langs
    :straight t
    :ensure t
    :after tree-sitter
    )

(require 'tree-sitter-hl)



```


In GNU Emacs 29.1 (build 2, x86_64-pc-linux-gnu, GTK+ Version 3.24.20,
cairo version 1.16.0) of 2023-12-10 built on lcy02-amd64-098
Repository revision: 28fb02492c2444c5976eb53fd6f9badfe54f4ea1
Repository branch: master
Windowing system distributor 'The X.Org Foundation', version 11.0.12101004
System Description: Linux Mint 21.2

Configured using:
'configure --prefix=/snap/emacs/current/usr --with-x-toolkit=gtk3
--without-xaw3d --with-modules --with-cairo
--with-native-compilation=aot --with-xinput2 --with-tree-sitter
--with-json
'CFLAGS=-isystem/build/emacs/parts/emacs/install/usr/include
-isystem/build/emacs/parts/emacs/install/usr/include/x86_64-linux-gnu
-isystem/build/emacs/stage/usr/include -O2'
'CPPFLAGS=-isystem/build/emacs/parts/emacs/install/usr/include
-isystem/build/emacs/parts/emacs/install/usr/include/x86_64-linux-gnu
-isystem/build/emacs/stage/usr/include'
'LDFLAGS=-L/build/emacs/parts/emacs/install/lib
-L/build/emacs/parts/emacs/install/usr/lib
-L/build/emacs/parts/emacs/install/lib/x86_64-linux-gnu
-L/build/emacs/parts/emacs/install/usr/lib/x86_64-linux-gnu
-L/build/emacs/stage/usr/lib''

Configured features:
ACL CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GPM GSETTINGS HARFBUZZ JPEG
JSON LCMS2 LIBOTF LIBSELINUX LIBSYSTEMD LIBXML2 M17N_FLT MODULES
NATIVE_COMP NOTIFY INOTIFY PDUMPER PNG RSVG SECCOMP SOUND SQLITE3
THREADS TIFF TOOLKIT_SCROLL_BARS TREE_SITTER X11 XDBE XIM XINPUT2 XPM
GTK3 ZLIB

Important settings:
  value of $LANG: en_CA.UTF-8
  locale-coding-system: utf-8-unix

Major mode: Fundamental

Minor modes in effect:
  tooltip-mode: t
  global-eldoc-mode: t
  show-paren-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  tool-bar-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  blink-cursor-mode: t
  buffer-read-only: t
  line-number-mode: t
  indent-tabs-mode: t
  transient-mark-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t

Load-path shadows:
None found.

Features:
(shadow sort mail-extr emacsbug message mailcap yank-media puny dired
dired-loaddefs rfc822 mml mml-sec password-cache epa derived epg rfc6068
epg-config gnus-util text-property-search time-date mm-decode mm-bodies
mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader sendmail
rfc2047 rfc2045 ietf-drums mm-util mail-prsvr mail-utils site-start comp
comp-cstr warnings icons subr-x rx cl-seq cl-macs gv cl-extra help-mode
cl-loaddefs cl-lib bytecomp byte-compile rmc iso-transl tooltip cconv
eldoc paren electric uniquify ediff-hook vc-hooks lisp-float-type
elisp-mode mwheel term/x-win x-win term/common-win x-dnd tool-bar dnd
fontset image regexp-opt fringe tabulated-list replace newcomment
text-mode lisp-mode prog-mode register page tab-bar menu-bar rfn-eshadow
isearch easymenu timer select scroll-bar mouse jit-lock font-lock syntax
font-core term/tty-colors frame minibuffer nadvice seq simple cl-generic
indonesian philippine cham georgian utf-8-lang misc-lang vietnamese
tibetan thai tai-viet lao korean japanese eucjp-ms cp51932 hebrew greek
romanian slovak czech european ethiopic indian cyrillic chinese
composite emoji-zwj charscript charprop case-table epa-hook
jka-cmpr-hook help abbrev obarray oclosure cl-preloaded button loaddefs
theme-loaddefs faces cus-face macroexp files window text-properties
overlay sha1 md5 base64 format env code-pages mule custom widget keymap
hashtable-print-readable backquote threads dbusbind inotify lcms2
dynamic-setting system-font-setting font-render-setting cairo
move-toolbar gtk x-toolkit xinput2 x multi-tty make-network-process
native-compile emacs)

Memory information:
((conses 16 81329 7534)
(symbols 48 7142 0)
(strings 32 19747 1922)
(string-bytes 1 602929)
(vectors 16 16576)
(vector-slots 8 333053 16182)
(floats 8 27 24)
(intervals 56 417 0)
(buffers 984 12))

[-- Attachment #2: Type: text/html, Size: 9877 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-01-03 17:50 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-01-03  3:33 bug#68233: 29.1; tree-sitter-hl-mode doesn't honor the :extend font face in single line comments Michael Labbé
2024-01-03 17:50 ` Eli Zaretskii

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.