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: Tree-sitter integration on feature/tree-sitter Date: Tue, 10 May 2022 16:53:02 -0700 Message-ID: References: <87y1zabmbt.fsf@gmail.com> <5F186EBD-CD21-422B-8B4F-0D5424173334@gmail.com> <875ymdwf76.fsf@gmail.com> <011DA1A3-0FA8-4449-878A-FD6B336B0F1B@gmail.com> <8735hhw75p.fsf@gmail.com> <19800217-D8DC-4197-8251-CFADA79B34FD@gmail.com> Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3696.80.82.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="354"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Yoav Marco , emacs-devel@gnu.org To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Wed May 11 01:54:28 2022 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 1noZgS-000ASS-Fi for ged-emacs-devel@m.gmane-mx.org; Wed, 11 May 2022 01:54:28 +0200 Original-Received: from localhost ([::1]:57420 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1noZgR-00013d-7I for ged-emacs-devel@m.gmane-mx.org; Tue, 10 May 2022 19:54:27 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:57298) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1noZfE-0000Lw-UU for emacs-devel@gnu.org; Tue, 10 May 2022 19:53:13 -0400 Original-Received: from mail-pl1-x62c.google.com ([2607:f8b0:4864:20::62c]:38768) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1noZf9-0007RD-B7 for emacs-devel@gnu.org; Tue, 10 May 2022 19:53:08 -0400 Original-Received: by mail-pl1-x62c.google.com with SMTP id n18so264525plg.5 for ; Tue, 10 May 2022 16:53:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=fJzR//b+r+HeSvy9ynltPuo54mEGF1JSFTJZ5KdkMsk=; b=imqNFp/bXfKAxj9zg1GlnMuNatnpQ8hGjlAK5swpMO6NLbnF74kATdkf2C8yVzM+dB fHOLToZtS4E//nwHrxp01yuhai066sy/Z3nCLIbqgQT6eABzbUomMSsIDmgj/TrrqHMN nh6a9kDZBA3Sqai7QS7G4VvsyCJfaDkoNvHpyjqVpp5YuLv6fTVwx161Tj70LxNGEonx thJwcpkuJR9yqhlOiFU/4QuN3BnF1ADewh8qPSLJS32e+gkhLYqE7Jyv3ryTlRJqV484 G7aA3YuUX7Ujfmy0+c31uEJW+fE1WR2iJu9Q4k7M0oA7WbVut7DIn18beDk0I123P9TM 1wQA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=fJzR//b+r+HeSvy9ynltPuo54mEGF1JSFTJZ5KdkMsk=; b=A6tbcGdlvfWJ1sr0WGUgqJm9kPNLgpfJR4mNvIRTUahDhw/Y2CpufGB5SZYi8zWR70 F8xYVbQDGASrfROCklTNM/UglnSKb3uF5Ts+GIInUkB3EYrEDJhkSqg49ScHT9GOtE0L 6zSqI/uzi8JAkVQhXj6SgWuP5ZgU4a/dEC6xjWt0kn03ux3x4+6pQpU8S+nstSx9GLJR CltwsY48EHjYhIHvuF+FLhyd4QvgiBZEkjRfmzUyezIBGRt973MgjJvQMzAbr1wmYISR LyPkkgMzwBpGWZ02RzoRKChVO2DZyUOlJAWaEXpf1Us7OlZvK1xQvOV80txY3A2qpYMM iqfw== X-Gm-Message-State: AOAM533kXw5PRob1/3jQLVO9MERcGtbcILM32Ba+y2S0CKCvTwyKD3Q5 FMqcBMOZsIVc75l7XRO/DYk= X-Google-Smtp-Source: ABdhPJx54dcBbodd3bpe5NCG9aAVTYIpKw1nV1r1+bx8MA2Z2u/Vj0GYFYveWouYQmv00grdtwO1kA== X-Received: by 2002:a17:902:da8b:b0:15e:c0e8:d846 with SMTP id j11-20020a170902da8b00b0015ec0e8d846mr22812805plx.34.1652226785500; Tue, 10 May 2022 16:53:05 -0700 (PDT) Original-Received: from smtpclient.apple ([128.54.40.156]) by smtp.gmail.com with ESMTPSA id g185-20020a636bc2000000b003c14af505efsm303573pgc.7.2022.05.10.16.53.04 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 10 May 2022 16:53:05 -0700 (PDT) In-Reply-To: <19800217-D8DC-4197-8251-CFADA79B34FD@gmail.com> X-Mailer: Apple Mail (2.3696.80.82.1.1) Received-SPF: pass client-ip=2607:f8b0:4864:20::62c; envelope-from=casouri@gmail.com; helo=mail-pl1-x62c.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, T_SCC_BODY_TEXT_LINE=-0.01 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" Xref: news.gmane.io gmane.emacs.devel:289607 Archived-At: > On May 10, 2022, at 4:11 PM, Yuan Fu wrote: >=20 >=20 >=20 >> On May 10, 2022, at 12:58 PM, Stefan Monnier = wrote: >>=20 >>> Eli/Stefan, please guide us! >>=20 >> I don't have much to say. OK, let's invent something: >>=20 >> 1- Maybe it would be good to expose "compiled query" objects to = ELisp, >> so the compilation could be performed by explicit requests (so you >> don't have to cache it, instead the major modes would call the >> function when installing their indentation/fontlock rules). >=20 > Maybe something like (treesit-cache-query key query), that saves = exposing another type to lisp. >=20 >=20 >>=20 >> 2- I don't understand why the use of hash map is perceived as = complex. >> It seems like a fairly simple solution. >=20 > I=E2=80=99m not sure how would we garbage collect unused queries, = maybe I=E2=80=99m missing something. And is there a C hash table that we = can use? Or we need to use the lisp hash table?=20 >=20 > Maybe we can use a buffer-local treesit--query-cache hash table and = store USERPTR of TSQuery in it, so we don=E2=80=99t worry about garbage = collecting. Would that be slow (getting the buffer-local variable, do a = lookup, takeout the TSQuery object)? Or just expose query object, and let user store them in lisp. Is there = any downsides of exposing another type to lisp? Currently tree-sitter = adds two new types: treesit-node and treesit-parser. Yuan=