From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Theodor Thornhill Newsgroups: gmane.emacs.devel Subject: Re: Comments to the new tree sitter implementation Date: Mon, 25 Apr 2022 21:08:44 +0200 Message-ID: <87v8uxx9oj.fsf@thornhill.no> References: <87y1zwq8sf.fsf@thornhill.no> <06C91D4F-3505-45B9-8340-BADE3EE665D1@gmail.com> Mime-Version: 1.0 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="18999"; mail-complaints-to="usenet@ciao.gmane.io" Cc: emacs-devel To: Yuan Fu Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Mon Apr 25 21:09:42 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 1nj45c-0004kY-Tr for ged-emacs-devel@m.gmane-mx.org; Mon, 25 Apr 2022 21:09:41 +0200 Original-Received: from localhost ([::1]:45628 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nj45b-000432-PJ for ged-emacs-devel@m.gmane-mx.org; Mon, 25 Apr 2022 15:09:39 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:48204) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nj44r-0002yY-4E for emacs-devel@gnu.org; Mon, 25 Apr 2022 15:08:54 -0400 Original-Received: from out0.migadu.com ([94.23.1.103]:12280) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nj44o-000826-95 for emacs-devel@gnu.org; Mon, 25 Apr 2022 15:08:52 -0400 X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=thornhill.no; s=key1; t=1650913726; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=QrwAvkOOYC7kr2KjuBb/TDVZwUptubr/Eb3R7Mi05gc=; b=iXKWn8+Z/ALQrlXKH4X3fZdLKzi+xTK78Fv5VTXUnEf8eGgjaJrgxkcowO8I/2YXxvzaXc 6nXYyhYZWyQjjNTGHR/By3kemxG2pS/0pnWH0SijywaIYnXxDBm0TQU79cqOqeVaktfOaF SonB8psWbtcmbPqg3SDNtj0dU17ieGDD0i1JrZe26NWzM+YkmCRyZJkx3/ogJ5ut74k32Q BXusiBhDdmlcRU1CN9O6N8SX6KUiasScBp5prLzXzo6CC3pk+dXqVF1Jgj+jRaiIljuE/N k8NaZXY+1cP+4BlvmNEH6H0SCYpvV/tCp3qO4u2xC4kra99EAFqxu0eK9U8CgQ== In-Reply-To: <06C91D4F-3505-45B9-8340-BADE3EE665D1@gmail.com> X-Migadu-Flow: FLOW_OUT X-Migadu-Auth-User: thornhill.no Received-SPF: pass client-ip=94.23.1.103; envelope-from=theo@thornhill.no; helo=out0.migadu.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 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, RCVD_IN_DNSWL_LOW=-0.7, 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:288875 Archived-At: Hi, there! > > Sorry that I can=E2=80=99t get back to you very soon. I=E2=80=99ve been i= ncredibly > busy recently. I=E2=80=99ll find time to look at your points and try to d= ebug > the problems you mention with typescript-ts.el. > No worries. I'll just note one more thing because I remember it now: Why are you calling the font lock default function after tree sitter has done its job? That seems like the wrong thing for several reasons: 1. Shouldn't tree sitter be sufficient? 2. It makes the default function get higher precedence than tree-sitter, causing some troublesome behavior. Specifically, if you set single-quote as a string in the syntax table, to make the major mode understand it as a string delimiter, it will mess up comments. This example snippet will make the rest of the file fontlock as a string: ```typescript function foo() { // don't mark the rest of the file as a string because of this: // ^ const dont =3D 3; const do =3D "": const it =3D {}; } ``` If the last two lines of `tree-sitter-font-lock-fontify-region` are removed, things appear to work as normal. It also works fine with things such as eglot marking a variable as unused in the comment face etc. All the best, Theodor