From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Yuan Fu Newsgroups: gmane.emacs.devel Subject: Re: Question on getting tree-sitter matches Date: Sun, 12 Mar 2023 19:34:59 -0700 Message-ID: References: <87cz5ekpl9.fsf@meain.io> Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3731.400.51.1.1\)) Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="26122"; mail-complaints-to="usenet@ciao.gmane.io" Cc: emacs-devel@gnu.org To: Abin Simon Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Mon Mar 13 03:36:05 2023 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pbY2f-0006Zp-Fk for ged-emacs-devel@m.gmane-mx.org; Mon, 13 Mar 2023 03:36:05 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pbY1w-0002hS-70; Sun, 12 Mar 2023 22:35:20 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pbY1v-0002h5-5h for emacs-devel@gnu.org; Sun, 12 Mar 2023 22:35:19 -0400 Original-Received: from mail-pj1-x1030.google.com ([2607:f8b0:4864:20::1030]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pbY1t-0007Y1-LF for emacs-devel@gnu.org; Sun, 12 Mar 2023 22:35:18 -0400 Original-Received: by mail-pj1-x1030.google.com with SMTP id ce8-20020a17090aff0800b0023a61cff2c6so12223210pjb.0 for ; Sun, 12 Mar 2023 19:35:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1678674912; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=xfCGNce66/oIiH82PjubRRw2jUuob+nDaJLxFjHbH64=; b=fwjTox//Xub9wsA4vx1FW83aM7txbVbOgiVuQAqb+Mwt2QiQNIKK7Nk6OQB1/OOms8 RRS/pnrWixzXrXT/zURJZjTl7ry+O2JJ/GBaFKqZQyw/a3uXDJx7UVNbIsJnNJjLO2q1 ddShi+krSwQVUTW4wSoA8+XlusbPbzMoLuRcd9z5LPjaddNh9wwctshj4c9YpbU1Tfom IkXf4rhL7Y+nKZy6J5SOhrecjBSR/UDJPMD+xTLCNjLFfN09JGJ5uzko6AvBdAqsBeYj ArDYDwxJuR/xFpUKJ87r9017gvFGHSUyyXfWY/xEzJuYLOzlmRV0qY0HbUus7+kKIUn7 RKrg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678674912; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=xfCGNce66/oIiH82PjubRRw2jUuob+nDaJLxFjHbH64=; b=RW1yws9Jaa/7dS9TI7+ybweYZtZ80nMN8sCI2+tzHQuj0iZvWGXBB9XkYKdjJ+iUcx 1F9xeHYVR5pARVYHiScBBU+7o0ivfqshEyy0is6eo0+yrRy5C4i6NVCUjzP1ALSfjdSr eLleD+AkdZWXfJNwvdEM+Jm/usU8lCQLbZarbP93ROqL7uHvLwDr1UmhfUPQDsH9TyXI edrfAxFno/vZodafwpe/PeCd50MVDLZ14WjiCvkUerLqFYUjgDQ3zfGT6hmkAx3CAq9o pduvQxIOPiNOV40XHJXSLDuwskgxMPTbDYZwiVyF0qXH2kIIt82C5vcxruE3PPjGXUi4 8wyA== X-Gm-Message-State: AO0yUKU2TdUONNDMZPhyzzQaUfWQZ3cdtZRZc5QDoBulKEzxG3TIxeYH XJ24rg7VGZ03L+8MgCUKFiWDP0fgqU9JRQ== X-Google-Smtp-Source: AK7set8dM6PARB81g5zLyggNPdASVQ0KSuKHq/tkAghVP4PKz/tyx8bi75sNSdSZ8uT2z5W0nWETVQ== X-Received: by 2002:a17:903:2349:b0:19f:9fcf:d0c6 with SMTP id c9-20020a170903234900b0019f9fcfd0c6mr3028603plh.25.1678674911944; Sun, 12 Mar 2023 19:35:11 -0700 (PDT) Original-Received: from smtpclient.apple (cpe-172-117-161-177.socal.res.rr.com. [172.117.161.177]) by smtp.gmail.com with ESMTPSA id h18-20020a17090adb9200b0023b5528b8d4sm1482184pjv.19.2023.03.12.19.35.10 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sun, 12 Mar 2023 19:35:11 -0700 (PDT) In-Reply-To: <87cz5ekpl9.fsf@meain.io> X-Mailer: Apple Mail (2.3731.400.51.1.1) Received-SPF: pass client-ip=2607:f8b0:4864:20::1030; envelope-from=casouri@gmail.com; helo=mail-pj1-x1030.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:304382 Archived-At: > On Mar 12, 2023, at 7:32 AM, Abin Simon wrote: >=20 > Hey, >=20 > How would I get the set of matches from tree-sitter with items from = the > same query together. >=20 > For example if I have a query of the following form: >=20 > (function_declaration (identifier) @id) @func >=20 > elisp-tree-sitter returns this as the output of `tsc-query-matches`: >=20 > [(0 . [ > (func . #) > (id . #) > ] > ) > (0 . [ > (func . #) > (id . #) > ] > ) > ] >=20 >=20 > This groups the matches from the same "query" together. >=20 > I could only find `treesit-query-capture` which just returns a list of > captures items in the following form: >=20 > ( > (func . #) > (id . #) > (func . #) > (id . #) > ) >=20 Unfortunately, that=E2=80=99s currently not possible. Could you = elaborate on why you need such feature? Thanks, Yuan