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:11:23 -0700 Message-ID: <19800217-D8DC-4197-8251-CFADA79B34FD@gmail.com> 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> 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="3963"; 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:12:06 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 1noZ1S-0000p0-62 for ged-emacs-devel@m.gmane-mx.org; Wed, 11 May 2022 01:12:06 +0200 Original-Received: from localhost ([::1]:47406 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1noZ1Q-0007VE-Me for ged-emacs-devel@m.gmane-mx.org; Tue, 10 May 2022 19:12:04 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:51022) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1noZ0q-0006p2-P8 for emacs-devel@gnu.org; Tue, 10 May 2022 19:11:28 -0400 Original-Received: from mail-pg1-x52a.google.com ([2607:f8b0:4864:20::52a]:41616) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1noZ0p-0001ml-8k for emacs-devel@gnu.org; Tue, 10 May 2022 19:11:28 -0400 Original-Received: by mail-pg1-x52a.google.com with SMTP id 31so234335pgp.8 for ; Tue, 10 May 2022 16:11:26 -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=i1ywp8FnWnYEDaPQ/bV1Rl4jB4gpyfKoNS4eMo6KtLI=; b=VvF8dkj21bj8Fka/1zmsMR8O+hN5Zphlz4aP+sa4LEp3sa3OHxsz6nehm27kDxcCvt /j7kvS8/cMP2KfCAfd+c8Cvyo/0O/25eRcLrsOjuLeRhmIekWQTX1/KMMWia5dbtifbY aJm33OhZC+Xex+P6ZvoLpA6EPQUTHsgid90jc97JMPeV2JVYuPQNXsO1TvqKYtqo9fkU opbiN1LJuo6ZTI8e+rOb2QxxTc7KNDGkE+Cn/aHzIlywGj2Li3PEQ8vSl9SnByZeeJrX /CWJLvM8r1tjkp3eGlraDGvY1McDAHrmkgSSlgoODVV/bemglcxPi0RSXdTWrPTrtEF4 4RVg== 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=i1ywp8FnWnYEDaPQ/bV1Rl4jB4gpyfKoNS4eMo6KtLI=; b=VWWzq6wN5IoB+nK2D8cSo3+fY/983ou4K15yBHWj6/AShBsziy0Zjm2C92w1yiyuNU Zb2sYWTm2vFxQPq+sxPxCNNQJw58j++qYhlDpBiLsDcH8Aw8TWT2F1t95N20RxxTk7ni rRMkBVAP7WK/jk97r8+n95FQLway2RQmHRTSTSTUP0356PLTLoVsIA7+W0q3S1H41UiR sKUiQElCzp8/wPi6lmpuN5Hd3xIskFg4bccixmAyzDdxFXwJdW6yuKwC2Ra4puH/Et+2 QXr9kJZfxvonSSg40jMfae000d2SZDRqMUUSuO4gTg/Bq8TZ21birBvIHT8hNqfQk/XY kIiw== X-Gm-Message-State: AOAM531VZvoFhp1UDhAkR1tG2uPjZnWJLTedFwS+q9D8AhxUTzOEABSl wNsV9HVPJmzqNiJpCYeRpoY= X-Google-Smtp-Source: ABdhPJxl/4HB3T9exghcc02LQpSji6l78BH0Ky+vw0HFc+p6FFHcBSIFPyE5U66fVD9DsUV4+s2abg== X-Received: by 2002:a05:6a00:a94:b0:4fd:c14b:21cb with SMTP id b20-20020a056a000a9400b004fdc14b21cbmr22352727pfl.53.1652224285754; Tue, 10 May 2022 16:11:25 -0700 (PDT) Original-Received: from smtpclient.apple ([128.54.40.95]) by smtp.gmail.com with ESMTPSA id o2-20020a170902778200b0015e8d4eb290sm148029pll.218.2022.05.10.16.11.24 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 10 May 2022 16:11:25 -0700 (PDT) In-Reply-To: X-Mailer: Apple Mail (2.3696.80.82.1.1) Received-SPF: pass client-ip=2607:f8b0:4864:20::52a; envelope-from=casouri@gmail.com; helo=mail-pg1-x52a.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:289606 Archived-At: > 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). Maybe something like (treesit-cache-query key query), that saves = exposing another type to lisp. >=20 > 2- I don't understand why the use of hash map is perceived as complex. > It seems like a fairly simple solution. 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 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)? Yuan=