From: Vincenzo Pupillo <v.pupillo@gmail.com>
To: Eli Zaretskii <eliz@gnu.org>, Theodor Thornhill <theo@thornhill.no>
Cc: 64647@debbugs.gnu.org, jostein@kjonigsen.net
Subject: bug#64647: treesit-query-error due to a recent change to tree-sitter-javascript grammar definition
Date: Sun, 16 Jul 2023 20:00:43 +0200 [thread overview]
Message-ID: <1861187.tdWV9SEqCh@fedora> (raw)
In-Reply-To: <87lefgdzea.fsf@thornhill.no>
In data domenica 16 luglio 2023 10:38:37 CEST, Theodor Thornhill ha scritto:
> Eli Zaretskii <eliz@gnu.org> writes:
> >> Yeah, I think we can do that in this case. I'm just wondering whether
> >> it's worth the effort or not.
> >
> > AFAIU, people tend to have old grammar libraries all the time. For
> > example, we had a couple of bug reports for C or C++ which turned out
> > to be due to grammar libraries that are not the latest HEAD of their
> > respective repositories. Some people tend to use only official
> > releases of those grammar libraries (for those which make releases;
> > many don't). Also, you cannot upgrade the library while the Emacs
> > session which uses it is running, so people who have long-running
> > sessions and don't like to restart Emacs sometimes have no choice but
> > to stay with an old library for some time.
> >
> > For these and other reasons, I think being less rigid in requiring the
> > latest grammar libraries will benefit our users.
>
> Sure!
>
> >> Should we introduce some notion of
> >> "deprecated" tree sitter functionalities? Otherwise I guess we'll have
> >> to maintain a growing set of compat-code, which over time will incur a
> >> performance cost, and it may be difficult to remember what code is
> >> compat-code and what isn't.
> >
> > I'm not afraid of compatibility code, as long as it's manageable. We
> > could retire some of that as time passes. But we are not yet at a
> > point where this compatibility code presents any significant issue, so
> > I'd rather we delayed the decision until we come to that bridge.
> >
> > 1> > I can rewrite both patches in the same way I had patched
> > java-ts-mode.
> >
> >> > Basically, there are only two changes. I think it would be useful to
> >> > have a
> >> > function to check whether grammar features are supported or not. For
> >> > example, a specialized version of treesit-query-validate that could
> >> > also be used in interactive mode (to simplify the development).
> >> >
> >> > Do I rewrite the patches?
> >>
> >> I seem to have missed the java-ts-mode patch. Where is it? Do you have
> >> such an implementation ready at hand? To me it sounds smart to have such
> >> a function, and it sounds like it should be in treesit.el, but that
> >> would probably be too late for emacs-29, I think?
> >
> > A function will probably go to master, but an ad-hoc compatibility fix
> > that doesn't regress for older grammar libraries would be welcome on
> > emacs-29 (assuming it is not very complicated).
> >
> > Thanks.
>
> Sure - unless Vincenzo wants to tackle it, I can look into creating a
> function for master to check for available features.
I am not familiar with the internal emacs treesitter binding. I would need
some time to study it. However, I have seen that there are functions in the
treesitter library that are not used by the current binding implementation.
For example: ts_language_field_id_for_name could be useful to check whether a
symbol is defined or not.
In my patch for java-ts-mode I used treesit-query-capture to figure out whether
a symbol was defined or not. Check out the java-ts-mode--string-highlight-
helper function.
>
> Vincenzo, do you want to add compat-code to emacs-29 and your patches?
Okay. I think I can do it this week. Do I create a new file, like treesitter-
compat.el ?
> I can take care of the in-core function in a separate bug, if that makes
> sense :)
>
> Theo
Vincenzo
next prev parent reply other threads:[~2023-07-16 18:00 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-15 12:34 bug#64647: treesit-query-error due to a recent change to tree-sitter-javascript grammar definition Vincenzo Pupillo
2023-07-15 12:57 ` Eli Zaretskii
2023-07-15 13:23 ` Theodor Thornhill via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-07-15 17:54 ` Theodor Thornhill via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-07-15 19:16 ` Eli Zaretskii
2023-07-15 19:39 ` Vincenzo Pupillo
2023-07-15 20:45 ` Theodor Thornhill via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-07-16 5:13 ` Eli Zaretskii
2023-07-16 8:38 ` Theodor Thornhill via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-07-16 18:00 ` Vincenzo Pupillo [this message]
2023-07-16 18:19 ` bug#64647: " Eli Zaretskii
2023-07-16 18:56 ` Theodor Thornhill via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-07-17 21:24 ` Vincenzo Pupillo
2023-07-19 5:11 ` Theodor Thornhill via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-07-20 10:14 ` Vincenzo Pupillo
2023-07-22 6:41 ` bug#64647: " Eli Zaretskii
2023-07-22 7:29 ` Theodor Thornhill via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-07-22 8:52 ` Eli Zaretskii
2023-07-22 11:56 ` Theodor Thornhill via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-07-22 14:10 ` Vincenzo Pupillo
2023-07-22 21:22 ` Theodor Thornhill via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-07-22 22:59 ` Yuan Fu
2023-07-23 5:17 ` Eli Zaretskii
2023-07-16 4:48 ` bug#64647: " Eli Zaretskii
2023-07-15 19:17 ` Vincenzo Pupillo
2023-07-15 20:51 ` Theodor Thornhill via Bug reports for GNU Emacs, the Swiss army knife of text editors
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1861187.tdWV9SEqCh@fedora \
--to=v.pupillo@gmail.com \
--cc=64647@debbugs.gnu.org \
--cc=eliz@gnu.org \
--cc=jostein@kjonigsen.net \
--cc=theo@thornhill.no \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.