GNU bug report logs -
#55428
[feature/tree-sitter] Simplify the parser creation API
Previous Next
To reply to this bug, email your comments to 55428 AT debbugs.gnu.org.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#55428
; Package
emacs
.
(Sun, 15 May 2022 14:17:01 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Daniel Martín <mardani29 <at> yahoo.es>
:
New bug report received and forwarded. Copy sent to
bug-gnu-emacs <at> gnu.org
.
(Sun, 15 May 2022 14:17:01 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
Currently, there are three functions to create a tree-sitter parser:
- treesit-get-parser-create
- treesit-get-parser
- treesit-parser-create
I think this set of similarly named functions can be reduced, so that
developers don't need to remember a lot of APIs. How I understand the
problem of creating a tree-sitter parser is that we need three things
from the developer:
- A programming language (a symbol).
- A buffer (optional, default to the current buffer).
- Whether to create or reuse an existing parser for that language.
I think it would be simpler to have just one parser creation API like
(treesit-make-parser LANGUAGE &optional BUFFER ALWAYS-NEW)
There are similar API patterns like this one already in Emacs. With
this proposed API, the common case, which is to create a parser for the
current buffer, and to try to reuse one if it already exists, is very
simple from the POV of an ELisp developer integrating with tree-sitter:
(treesit-make-parser 'c)
Any thoughts?
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#55428
; Package
emacs
.
(Sun, 15 May 2022 14:27:01 GMT)
Full text and
rfc822 format available.
Message #8 received at 55428 <at> debbugs.gnu.org (full text, mbox):
> Date: Sun, 15 May 2022 16:15:57 +0200
> From: Daniel Martín via "Bug reports for GNU Emacs,
> the Swiss army knife of text editors" <bug-gnu-emacs <at> gnu.org>
>
>
> Currently, there are three functions to create a tree-sitter parser:
>
> - treesit-get-parser-create
> - treesit-get-parser
> - treesit-parser-create
>
> I think this set of similarly named functions can be reduced, so that
> developers don't need to remember a lot of APIs. How I understand the
> problem of creating a tree-sitter parser is that we need three things
> from the developer:
>
> - A programming language (a symbol).
> - A buffer (optional, default to the current buffer).
> - Whether to create or reuse an existing parser for that language.
>
> I think it would be simpler to have just one parser creation API like
>
> (treesit-make-parser LANGUAGE &optional BUFFER ALWAYS-NEW)
I suggest that discussions about the API be held on emacs-devel, not
hear. That way, more people will see them and could decide whether to
participate.
Thanks.
Severity set to 'wishlist' from 'normal'
Request was from
Stefan Kangas <stefan <at> marxist.se>
to
control <at> debbugs.gnu.org
.
(Fri, 17 Jun 2022 09:42:02 GMT)
Full text and
rfc822 format available.
This bug report was last modified 2 years and 363 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.