GNU bug report logs - #70299
30.0.50; go-ts-mode + tree-sitter-go@v0.20.0 no highlighting

Previous Next

Package: emacs;

Reported by: Martin <martin.tang365 <at> googlemail.com>

Date: Tue, 9 Apr 2024 04:47:03 UTC

Severity: normal

Tags: patch

Merged with 70296

Found in versions 29.3.50, 30.0.50

Done: Randy Taylor <dev <at> rjt.dev>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 70299 in the body.
You can then email your comments to 70299 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#70299; Package emacs. (Tue, 09 Apr 2024 04:47:03 GMT) Full text and rfc822 format available.

Acknowledgement sent to Martin <martin.tang365 <at> googlemail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Tue, 09 Apr 2024 04:47:03 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Martin <martin.tang365 <at> googlemail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: 30.0.50; go-ts-mode + tree-sitter-go <at> v0.20.0 no highlighting
Date: Tue, 9 Apr 2024 00:43:57 +0100
[Message part 1 (text/plain, inline)]
--text follows this line--

- emacs -Q;
- M-x treesit-install-language-grammar
  - go
  - github.com/tree-sitter/tree-sitter-go

- Open up a new buffer and use go-ts-mode
- Write some go-code
```
package my_pkg
type myStruct struct {}
func MyFunc(x context.Context) error {}
```
- Observe that there is no syntax highlighting
- Observe that treesit-explore-mode seems to work properly
- Conclude that there is something wrong with go-ts-mode's
  highlighting. There is highlighting with tree-sitter-go v0.19.1, but
  that grammar also seems to come with some bugs.


In GNU Emacs 30.0.50 (build 1, aarch64-apple-darwin23.4.0, NS
 appkit-2487.50 Version 14.4.1 (Build 23E224)) of 2024-04-08 built on
 MF9VWRYQFN
Windowing system distributor 'Apple', version 10.3.2487
System Description:  macOS 14.4.1

Configured using:
 'configure --disable-dependency-tracking --disable-silent-rules
 --enable-locallisppath=/opt/homebrew/share/emacs/site-lisp
 --infodir=/opt/homebrew/Cellar/emacs-plus <at> 30/30.0.50/share/info/emacs
 --prefix=/opt/homebrew/Cellar/emacs-plus <at> 30/30.0.50 --with-xml2
 --with-gnutls --without-compress-install --without-dbus
 --without-imagemagick --with-modules --with-rsvg --with-webp --with-ns
 --disable-ns-self-contained 'CFLAGS=-Os -w -pipe
 -mmacosx-version-min=14
 -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX14.sdk
 -DFD_SETSIZE=10000 -DDARWIN_UNLIMITED_SELECT'
 'CPPFLAGS=-I/opt/homebrew/opt/icu4c/include
 -I/opt/homebrew/opt/sqlite/include -I/opt/homebrew/opt/readline/include
 -isystem/opt/homebrew/include -F/opt/homebrew/Frameworks
 -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX14.sdk'
 'LDFLAGS=-L/opt/homebrew/opt/icu4c/lib -L/opt/homebrew/opt/sqlite/lib
 -L/opt/homebrew/opt/readline/lib -L/opt/homebrew/lib
 -F/opt/homebrew/Frameworks -Wl,-headerpad_max_install_names
 -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX14.sdk''

Configured features:
ACL GIF GLIB GMP GNUTLS JPEG LCMS2 LIBXML2 MODULES NOTIFY KQUEUE NS
PDUMPER PNG RSVG SQLITE3 THREADS TIFF TOOLKIT_SCROLL_BARS TREE_SITTER
WEBP XIM ZLIB

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

Major mode: Go

Minor modes in effect:
  treesit-explore-mode: t
  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
  font-lock-mode: t
  blink-cursor-mode: t
  minibuffer-regexp-mode: 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 subr-x mm-decode
mm-bodies mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader
sendmail rfc2047 rfc2045 ietf-drums mm-util mail-prsvr mail-utils python
rx project byte-opt gv bytecomp byte-compile compat pcase comint
ansi-osc ring ansi-color cl-seq go-ts-mode treesit vc-git diff-mode
easy-mmode vc-dispatcher cl-loaddefs cl-lib rmc iso-transl tooltip cconv
eldoc paren electric uniquify ediff-hook vc-hooks lisp-float-type
elisp-mode mwheel term/ns-win ns-win ucs-normalize mule-util
term/common-win 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 kqueue cocoa ns lcms2 multi-tty make-network-process emacs)

Memory information:
((conses 16 104850 12135) (symbols 48 7868 0) (strings 32 21254 2120)
 (string-bytes 1 586116) (vectors 16 14537)
 (vector-slots 8 156722 9447) (floats 8 27 34) (intervals 56 5547 0)
 (buffers 992 13))
[Message part 2 (text/html, inline)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#70299; Package emacs. (Tue, 09 Apr 2024 05:24:02 GMT) Full text and rfc822 format available.

Message #8 received at 70299 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Martin <martin.tang365 <at> googlemail.com>
Cc: 70299 <at> debbugs.gnu.org
Subject: Re: bug#70299: 30.0.50;
 go-ts-mode + tree-sitter-go <at> v0.20.0 no highlighting
Date: Tue, 09 Apr 2024 08:23:18 +0300
> Date: Tue, 9 Apr 2024 00:43:57 +0100
> From:  Martin via "Bug reports for GNU Emacs,
>  the Swiss army knife of text editors" <bug-gnu-emacs <at> gnu.org>
> 
> - emacs -Q;
> - M-x treesit-install-language-grammar
>   - go
>   - github.com/tree-sitter/tree-sitter-go
> 
> - Open up a new buffer and use go-ts-mode
> - Write some go-code 
> ```
> package my_pkg
> type myStruct struct {}
> func MyFunc(x context.Context) error {}
> ```
> - Observe that there is no syntax highlighting
> - Observe that treesit-explore-mode seems to work properly
> - Conclude that there is something wrong with go-ts-mode's
>   highlighting. There is highlighting with tree-sitter-go v0.19.1, but
>   that grammar also seems to come with some bugs.

Isn't this a duplicate of bug#70296?




Merged 70296 70299. Request was from Yuan Fu <casouri <at> gmail.com> to control <at> debbugs.gnu.org. (Tue, 09 Apr 2024 05:46:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#70299; Package emacs. (Tue, 09 Apr 2024 05:48:02 GMT) Full text and rfc822 format available.

Message #13 received at 70299 <at> debbugs.gnu.org (full text, mbox):

From: Yuan Fu <casouri <at> gmail.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: Martin <martin.tang365 <at> googlemail.com>, 70299 <at> debbugs.gnu.org
Subject: Re: bug#70299: 30.0.50; go-ts-mode + tree-sitter-go <at> v0.20.0 no
 highlighting
Date: Mon, 8 Apr 2024 22:47:24 -0700

> On Apr 8, 2024, at 10:23 PM, Eli Zaretskii <eliz <at> gnu.org> wrote:
> 
>> Date: Tue, 9 Apr 2024 00:43:57 +0100
>> From:  Martin via "Bug reports for GNU Emacs,
>> the Swiss army knife of text editors" <bug-gnu-emacs <at> gnu.org>
>> 
>> - emacs -Q;
>> - M-x treesit-install-language-grammar
>>  - go
>>  - github.com/tree-sitter/tree-sitter-go
>> 
>> - Open up a new buffer and use go-ts-mode
>> - Write some go-code 
>> ```
>> package my_pkg
>> type myStruct struct {}
>> func MyFunc(x context.Context) error {}
>> ```
>> - Observe that there is no syntax highlighting
>> - Observe that treesit-explore-mode seems to work properly
>> - Conclude that there is something wrong with go-ts-mode's
>>  highlighting. There is highlighting with tree-sitter-go v0.19.1, but
>>  that grammar also seems to come with some bugs.
> 
> Isn't this a duplicate of bug#70296?

Yeah, Martin contacted me on Reddit because he didn’t know how to report this issue, and I told him he can use M-x bug-report-emacs, which he did. Thanks Martin!

Meanwhile I wrote a patch and sent it in bug#70296. Let me merge these two reports.

Yuan



Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#70299; Package emacs. (Tue, 09 Apr 2024 11:57:02 GMT) Full text and rfc822 format available.

Message #16 received at 70299 <at> debbugs.gnu.org (full text, mbox):

From: Martin <martin.tang365 <at> googlemail.com>
To: Yuan Fu <casouri <at> gmail.com>
Cc: Eli Zaretskii <eliz <at> gnu.org>, 70299 <at> debbugs.gnu.org
Subject: Re: bug#70299: 30.0.50;
 go-ts-mode + tree-sitter-go <at> v0.20.0 no highlighting
Date: Tue, 9 Apr 2024 12:55:55 +0100
[Message part 1 (text/plain, inline)]
I tried manually applying that patch to my local emacs - it didn't seem to
fix the issue of no syntax highlighting?

On Tue, Apr 9, 2024 at 6:47 AM Yuan Fu <casouri <at> gmail.com> wrote:

>
>
> > On Apr 8, 2024, at 10:23 PM, Eli Zaretskii <eliz <at> gnu.org> wrote:
> >
> >> Date: Tue, 9 Apr 2024 00:43:57 +0100
> >> From:  Martin via "Bug reports for GNU Emacs,
> >> the Swiss army knife of text editors" <bug-gnu-emacs <at> gnu.org>
> >>
> >> - emacs -Q;
> >> - M-x treesit-install-language-grammar
> >>  - go
> >>  - github.com/tree-sitter/tree-sitter-go
> >>
> >> - Open up a new buffer and use go-ts-mode
> >> - Write some go-code
> >> ```
> >> package my_pkg
> >> type myStruct struct {}
> >> func MyFunc(x context.Context) error {}
> >> ```
> >> - Observe that there is no syntax highlighting
> >> - Observe that treesit-explore-mode seems to work properly
> >> - Conclude that there is something wrong with go-ts-mode's
> >>  highlighting. There is highlighting with tree-sitter-go v0.19.1, but
> >>  that grammar also seems to come with some bugs.
> >
> > Isn't this a duplicate of bug#70296?
>
> Yeah, Martin contacted me on Reddit because he didn’t know how to report
> this issue, and I told him he can use M-x bug-report-emacs, which he did.
> Thanks Martin!
>
> Meanwhile I wrote a patch and sent it in bug#70296. Let me merge these two
> reports.
>
> Yuan
[Message part 2 (text/html, inline)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#70299; Package emacs. (Tue, 09 Apr 2024 13:09:02 GMT) Full text and rfc822 format available.

Message #19 received at 70299 <at> debbugs.gnu.org (full text, mbox):

From: Martin <martin.tang365 <at> googlemail.com>
To: Yuan Fu <casouri <at> gmail.com>
Cc: Eli Zaretskii <eliz <at> gnu.org>, 70299 <at> debbugs.gnu.org
Subject: Re: bug#70299: 30.0.50;
 go-ts-mode + tree-sitter-go <at> v0.20.0 no highlighting
Date: Tue, 9 Apr 2024 14:08:01 +0100
[Message part 1 (text/plain, inline)]
I can see this in *Messages*

Error during redisplay: (jit-lock-function 6092) signaled
(treesit-query-error "Node type error at" 150 "(function_declaration name:
(identifier) @font-lock-function-name-face) (method_declaration name:
(field_identifier) @font-lock-function-name-face) (method_spec name:
(field_identifier) @font-lock-function-name-face) (field_declaration name:
(field_identifier) @font-lock-property-name-face) (parameter_declaration
name: (identifier) @font-lock-variable-name-face) (short_var_declaration
left: (expression_list (identifier) @font-lock-variable-name-face (\",\"
(identifier) @font-lock-variable-name-face) *)) (var_spec name:
(identifier) @font-lock-variable-name-face (\",\" name: (identifier)
@font-lock-variable-name-face) *)" "Debug the query with
`treesit-query-validate'")


On Tue, Apr 9, 2024 at 12:55 PM Martin <martin.tang365 <at> googlemail.com>
wrote:

> I tried manually applying that patch to my local emacs - it didn't seem to
> fix the issue of no syntax highlighting?
>
> On Tue, Apr 9, 2024 at 6:47 AM Yuan Fu <casouri <at> gmail.com> wrote:
>
>>
>>
>> > On Apr 8, 2024, at 10:23 PM, Eli Zaretskii <eliz <at> gnu.org> wrote:
>> >
>> >> Date: Tue, 9 Apr 2024 00:43:57 +0100
>> >> From:  Martin via "Bug reports for GNU Emacs,
>> >> the Swiss army knife of text editors" <bug-gnu-emacs <at> gnu.org>
>> >>
>> >> - emacs -Q;
>> >> - M-x treesit-install-language-grammar
>> >>  - go
>> >>  - github.com/tree-sitter/tree-sitter-go
>> >>
>> >> - Open up a new buffer and use go-ts-mode
>> >> - Write some go-code
>> >> ```
>> >> package my_pkg
>> >> type myStruct struct {}
>> >> func MyFunc(x context.Context) error {}
>> >> ```
>> >> - Observe that there is no syntax highlighting
>> >> - Observe that treesit-explore-mode seems to work properly
>> >> - Conclude that there is something wrong with go-ts-mode's
>> >>  highlighting. There is highlighting with tree-sitter-go v0.19.1, but
>> >>  that grammar also seems to come with some bugs.
>> >
>> > Isn't this a duplicate of bug#70296?
>>
>> Yeah, Martin contacted me on Reddit because he didn’t know how to report
>> this issue, and I told him he can use M-x bug-report-emacs, which he did.
>> Thanks Martin!
>>
>> Meanwhile I wrote a patch and sent it in bug#70296. Let me merge these
>> two reports.
>>
>> Yuan
>
>
[Message part 2 (text/html, inline)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#70299; Package emacs. (Tue, 09 Apr 2024 23:23:02 GMT) Full text and rfc822 format available.

Message #22 received at 70299 <at> debbugs.gnu.org (full text, mbox):

From: Randy Taylor <dev <at> rjt.dev>
To: Martin <martin.tang365 <at> googlemail.com>
Cc: Yuan Fu <casouri <at> gmail.com>, 70299 <at> debbugs.gnu.org,
 Eli Zaretskii <eliz <at> gnu.org>
Subject: Re: bug#70299: 30.0.50;
 go-ts-mode + tree-sitter-go <at> v0.20.0 no highlighting
Date: Tue, 09 Apr 2024 23:22:18 +0000
On Tuesday, April 9th, 2024 at 09:08, Martin via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs <at> gnu.org> wrote:
> I can see this in *Messages*
> 
> > Error during redisplay: (jit-lock-function 6092) signaled (treesit-query-error "Node type error at" 150 "(function_declaration name: (identifier) @font-lock-function-name-face) (method_declaration name: (field_identifier) @font-lock-function-name-face) (method_spec name: (field_identifier) @font-lock-function-name-face) (field_declaration name: (field_identifier) @font-lock-property-name-face) (parameter_declaration name: (identifier) @font-lock-variable-name-face) (short_var_declaration left: (expression_list (identifier) @font-lock-variable-name-face (\",\" (identifier) @font-lock-variable-name-face) *)) (var_spec name: (identifier) @font-lock-variable-name-face (\",\" name: (identifier) @font-lock-variable-name-face) *)" "Debug the query with `treesit-query-validate'")
> 
> 
> On Tue, Apr 9, 2024 at 12:55 PM Martin <martin.tang365 <at> googlemail.com> wrote:
> 
> > I tried manually applying that patch to my local emacs - it didn't seem to fix the issue of no syntax highlighting?
>>

The patch fixes it for me.

How did you apply the patch?

Perhaps the stale bytecompiled go-ts-mode.elc is used instead - can you try either regenerating it or setting load-prefer-newer to t and trying again?





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#70299; Package emacs. (Wed, 10 Apr 2024 08:40:01 GMT) Full text and rfc822 format available.

Message #25 received at 70299 <at> debbugs.gnu.org (full text, mbox):

From: Martin <martin.tang365 <at> googlemail.com>
To: dev <at> rjt.dev
Cc: Yuan Fu <casouri <at> gmail.com>, 70299 <at> debbugs.gnu.org,
 Eli Zaretskii <eliz <at> gnu.org>
Subject: Re: bug#70299: 30.0.50;
 go-ts-mode + tree-sitter-go <at> v0.20.0 no highlighting
Date: Wed, 10 Apr 2024 09:38:31 +0100
[Message part 1 (text/plain, inline)]
🤦

heh. yeah that was it. deleted the .elc and now it works. Weirdly, setting
load-prefer-newer to t did not fix the issue.. I probably did something
wrong there too.

Anyway, all good. Thanks!

On Wed, Apr 10, 2024 at 12:22 AM Randy Taylor <dev <at> rjt.dev> wrote:

> On Tuesday, April 9th, 2024 at 09:08, Martin via "Bug reports for GNU
> Emacs, the Swiss army knife of text editors" <bug-gnu-emacs <at> gnu.org>
> wrote:
> > I can see this in *Messages*
> >
> > > Error during redisplay: (jit-lock-function 6092) signaled
> (treesit-query-error "Node type error at" 150 "(function_declaration name:
> (identifier) @font-lock-function-name-face) (method_declaration name:
> (field_identifier) @font-lock-function-name-face) (method_spec name:
> (field_identifier) @font-lock-function-name-face) (field_declaration name:
> (field_identifier) @font-lock-property-name-face) (parameter_declaration
> name: (identifier) @font-lock-variable-name-face) (short_var_declaration
> left: (expression_list (identifier) @font-lock-variable-name-face (\",\"
> (identifier) @font-lock-variable-name-face) *)) (var_spec name:
> (identifier) @font-lock-variable-name-face (\",\" name: (identifier)
> @font-lock-variable-name-face) *)" "Debug the query with
> `treesit-query-validate'")
> >
> >
> > On Tue, Apr 9, 2024 at 12:55 PM Martin <martin.tang365 <at> googlemail.com>
> wrote:
> >
> > > I tried manually applying that patch to my local emacs - it didn't
> seem to fix the issue of no syntax highlighting?
> >>
>
> The patch fixes it for me.
>
> How did you apply the patch?
>
> Perhaps the stale bytecompiled go-ts-mode.elc is used instead - can you
> try either regenerating it or setting load-prefer-newer to t and trying
> again?
>
>
[Message part 2 (text/html, inline)]

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Thu, 09 May 2024 11:24:11 GMT) Full text and rfc822 format available.

This bug report was last modified 7 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.