From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: =?UTF-8?Q?=C3=AC=C2=A1=C2=B0=C3=AC=C2=84=C2=B1=C3=AB=C2=B9=C2=88_via_=22E?= =?UTF-8?Q?macs_development_discussions=2E?= Newsgroups: gmane.emacs.devel Subject: Re: Reliable after-change-functions (via: Using incremental parsing in Emacs) Date: Fri, 3 Apr 2020 03:03:32 +0900 Message-ID: References: <83tv22x9lx.fsf@gnu.org> Reply-To: =?UTF-8?Q?Reply-to=3A_=C3=AC=C2=A1=C2=B0=C3=AC=C2=84=C2=B1=C3=AB=C2=B9?= =?UTF-8?Q?=C2=88_=3Cpcr910303=40icloud=2Ecom=3E=0A?= Mime-Version: 1.0 (Mac OS X Mail 13.4 \(3608.80.23.2.2\)) Content-Type: text/plain; charset=utf-8; delsp=yes; format=flowed Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="127094"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Dmitry Gutov , acm@muc.de, casouri@gmail.com, Emacs-devel@gnu.org, monnier@iro.umontreal.ca, akrl@sdf.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Thu Apr 02 20:04:29 2020 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 1jK4Ca-000Wvt-TS for ged-emacs-devel@m.gmane-mx.org; Thu, 02 Apr 2020 20:04:28 +0200 Original-Received: from localhost ([::1]:45656 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jK4CZ-0002XG-VQ for ged-emacs-devel@m.gmane-mx.org; Thu, 02 Apr 2020 14:04:27 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:52180) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jK4Bt-00026G-5E for emacs-devel@gnu.org; Thu, 02 Apr 2020 14:03:46 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jK4Br-0006Hv-Pj for emacs-devel@gnu.org; Thu, 02 Apr 2020 14:03:45 -0400 Original-Received: from pv50p00im-zteg10021301.me.com ([17.58.6.46]:49319) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1jK4Br-0006HC-Jc for emacs-devel@gnu.org; Thu, 02 Apr 2020 14:03:43 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=icloud.com; s=1a1hai; t=1585850620; bh=IBQA5k0+0lWFZKCaulqbhYqDuOrBalCeJ9E4igE9K6I=; h=Content-Type:Subject:From:Date:Message-Id:To; b=JkLiGkoAOfkhDZ4m/lDtY+Yeh6xEn9VRXhtsfTIVF07K0fCN6D3cBrwvI8GZr0Ln8 Ma9Z4YNQTSHAi4zlon37SNl5NrlaLgzCYcEJw2HdUUn/s5mEENIZYcHADR00jAh/t2 IEFdmp8fM2kgRa+AQeCk96Q1Jmkn8pxgxUa/NKcKQ7MKVCQaVdOVFZ4v6jZHf+oro9 TrmK+32o3Ph+siJrZYKLK9JuFOx23GWAPQOteqU+MSKJnSfFFdYaJiXDlja0t6g0RI InGNexnYTEGQCY4KnvyrD06fW4NXqbTjPk4G8giDjsaIFMVoYyO8HBaDcy/PansyX3 gAtPXCj9rLvLQ== Original-Received: from [192.168.0.2] (unknown [1.230.108.64]) by pv50p00im-zteg10021301.me.com (Postfix) with ESMTPSA id 273B2580504; Thu, 2 Apr 2020 18:03:37 +0000 (UTC) In-Reply-To: <83tv22x9lx.fsf@gnu.org> X-Mailer: Apple Mail (2.3608.80.23.2.2) X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2020-04-02_08:, , signatures=0 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=1 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 mlxscore=0 mlxlogscore=967 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1908290000 definitions=main-2004020139 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 17.58.6.46 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 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:246280 Archived-At: > 2020. 4. 2. =EC=98=A4=ED=9B=84 11:10, Eli Zaretskii =EC=9E= =91=EC=84=B1: > =EF=BB=BF >> >> Cc: acm@muc.de, akrl@sdf.org, casouri@gmail.com, monnier@iro.umontreal= .ca, >> emacs-devel@gnu.org >> From: Dmitry Gutov >> Date: Thu, 2 Apr 2020 00:21:36 +0300 >> >>> If by TreeSitter you mean the parser (not the Emacs package which >>> interfaces it), then what I proposed is not against their design, >>> AFAIU. They provide an API through which we can let the parser acces= s >>> the buffer text directly, and they explicitly say that the parser is >>> tolerant to invalid/incomplete syntax trees. And I don't see how it >>> could be any different, since when you start writing code, it takes >>> quite some time before it becomes syntactically complete and valid. >> >> That makes sense, at least in theory. But I'd rather not break the usa= ge >> assumptions of the authors of this library right away. > > From what I could glean by reading the documentation, the above is not > necessarily against the assumptions of the tree-sitter developers. I > saw nothing that would indicate the initial full parse is a must. > That such full parse is unnecessary is what I would expect, because of > the use case that I start writing a source file from scratch. The situation of a new user creating a new buffer is very different from parsing code with only a peephole, because users don=E2=80=99t generally = expect unfinished code to be exactly highlighted, while users do expect finished code to have exact highlighting. Maybe it=E2=80=99s just because I got lost through a lot of emails, and M= ail.app doesn't really thread these emails properly, but I can=E2=80=99t understa= nd the resistance of the front-up parsing. The current shipping CC-Mode is parsing most of the code front-up, and clearly tree sitter will be faster than that. AFAIU parsing code only by only looking through a peephole is super hard except for some languages that are designed for peephole processing - and that makes it only hard, not super hard. >> And we'll likely want to adopt existing addons which use the result >> of the parse, which likely depend on the same assumptions. > > Those other addons must also support the "write from scratch" use > case, right? Then they should also support passing only part of the > buffer, since it could be that this is all I have in the buffer right > now. > >> Anyway, here's a (short) discussion on the topic of large files: >> https://github.com/tree-sitter/tree-sitter/issues/222 > > Thanks. This was long ago, though, so I'm not sure what became of > that (and Stefan's comment didn't yet get any responses to indicate > that this is a solved problem).