From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: =?UTF-8?B?VHXhuqVuLUFuaCBOZ3V54buFbg==?= Newsgroups: gmane.emacs.devel Subject: Re: Tree-sitter api Date: Fri, 17 Sep 2021 19:11:44 +0700 Message-ID: References: <83r1f7hydn.fsf@gnu.org> <8335qbirsr.fsf@gnu.org> <73E0B1F6-6F9F-40E0-927E-D08481BFF391@gmail.com> <834kaqhqlp.fsf@gnu.org> <8335qahqgk.fsf@gnu.org> <3BC29D06-CA75-4706-9AD7-ABA2F65C4DEE@gmail.com> <83v936fj35.fsf@gnu.org> <83r1dselyo.fsf@gnu.org> <6A4CE984-6ACE-4E66-8EF2-F3D351C02248@gmail.com> <83r1dscpt2.fsf@gnu.org> <83o88wcof9.fsf@gnu.org> <83lf3zdh4z.fsf@gnu.org> <8965C4A0-79D3-4D77-A6BA-D07A6C93F7FE@gmail.com> <83ilz3cs4k.fsf@gnu.org> <04D19C1A-CD64-4156-B932-1C9FEEE4EC7B@gmail.com> <83zgsebc0r.fsf@gnu.org> <1F752923-F357-4A18-B6E2-0120F1B9BD37@gmail.com> <83fsu5bzem.fsf@gnu.org> <83zgsdad5j.fsf@gnu.org> <83sfy391ni.fsf@gnu.org> <03386E3C-A975-4ECD-BF89-6AC62F751725@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="22645"; mail-complaints-to="usenet@ciao.gmane.io" Cc: =?UTF-8?Q?Cl=C3=A9ment_Pit=2DClaudel?= , Theodor Thornhill , Emacs developers , Stefan Monnier , Eli Zaretskii , Stephen Leake To: Yuan Fu Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Fri Sep 17 14:14:22 2021 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 1mRCl2-0005hB-O1 for ged-emacs-devel@m.gmane-mx.org; Fri, 17 Sep 2021 14:14:20 +0200 Original-Received: from localhost ([::1]:42944 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mRCl0-0007Zd-Rp for ged-emacs-devel@m.gmane-mx.org; Fri, 17 Sep 2021 08:14:18 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:36780) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mRCix-0006B2-8C for emacs-devel@gnu.org; Fri, 17 Sep 2021 08:12:11 -0400 Original-Received: from mail-pj1-x1031.google.com ([2607:f8b0:4864:20::1031]:39474) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mRCit-0001DF-4D; Fri, 17 Sep 2021 08:12:10 -0400 Original-Received: by mail-pj1-x1031.google.com with SMTP id c13-20020a17090a558d00b00198e6497a4fso9885255pji.4; Fri, 17 Sep 2021 05:12:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=3Lk0MqXjdAKuIdOqo3B75ELZpYOHW7Vt680PFsciUTQ=; b=ksgJEyYVx0on+4MSakeIJNp8t9VQJrnNqjdIpV1TkW51G6XrtqEPOcZBf8k1elEiYw YBpotjgQ+O/8b05jtnlYwz+nNNOldCav8YG3Rsf2odl19Jxc/NMoPBqYweN1dPfnHXRQ +Pad66XG/wd2WOlpBXwb/KqVD5Jh3z4CZVHGAEnK16gBgGDqMhzPlcknwQDik6jv2Hm/ s7/tE+zaY5FeBlYYutuFPWZaxSutbO/7NYgNzxmQY0EScIcsPPrqDY68sr2qYWzdAgaC W7aX3BAJEvQY7wvsh5YIqkVaRjY/X+szIdDi404SIve1x7sPbsTx57Z5L+r0ivCOGluv z9Jw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=3Lk0MqXjdAKuIdOqo3B75ELZpYOHW7Vt680PFsciUTQ=; b=u+LVhM+XvB366PSl5SM2Na4P20jAnjtJaQq5g+RVf5P/ZO4h3N4R841MHfDfGEz7Ql ggoZXwXzuKaFfZDmAMkD5BJfB7SUjQAfqR7gQNkatORwR3/wuwwDZMcuHVXpcxoGmu4t z5OwWbG63gpVV8kKdVlbNp4CRQq0lNVwIpxIKdj26ZoJyszxqHvy4YS41MU7bbSnhazR ZOqjz+d+QgC1XZxtfdfh/jtUu18LJ17WC3qwV+zfxpPW90RIkXD1ZhaJf0ScnSbqzIEY QlG9isszpXYQ091X0ZOB9GYoJiz7zEDwsZ2E3n/0TgX2rjaQDFXSh6wAYIVSxdyo4Y6G D1pA== X-Gm-Message-State: AOAM530qnnfOtvWdueFnSESRbsGkBQz/VH6ezyPHgmJx9fjw5mGKrhA/ yf+0O6GKHwlQZz8Qc9sw1YoR5tRWOIQZtxPHdoc= X-Google-Smtp-Source: ABdhPJwYpOeB5DsDq4KuvZTedsP/wakK1b+dlpoPxrEy/8jrQi/ybwiW58sOrseQEV6COqaWgCVYqMET9EROGAXUm74= X-Received: by 2002:a17:90a:af8f:: with SMTP id w15mr20733395pjq.90.1631880721946; Fri, 17 Sep 2021 05:12:01 -0700 (PDT) In-Reply-To: <03386E3C-A975-4ECD-BF89-6AC62F751725@gmail.com> Received-SPF: pass client-ip=2607:f8b0:4864:20::1031; envelope-from=ubolonton@gmail.com; helo=mail-pj1-x1031.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.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:274860 Archived-At: > And I want to also point out that as Emacs core developers, we can=E2=80= =99t possibly provide a good translation from convention language names to = their tree-sitter name (C# -> c-sharp). Maybe we can do a half-decent job, = but 1) that won=E2=80=99t cover all available languages, and 2) if there is= a new language, we need to wait for the next release to update our transla= tion. It is better for the major mode writers to provide the information on= how to translate names. Because, as I said earlier, they already know it. This makes sense. My suggestion is, in `tree-sitter.el`: (defvar tree-sitter-major-mode-language-alist '((c-mode . c) ;; And other major modes that Emacs includes, or are well-known. (c++-mode . cpp) (javascript-mode . javascript) (python-mode . python)) "Alist that maps major modes to tree-sitter language names.") For other major modes, it's up to the mode writers to add entries to that l= ist, similar to what they do with `auto-mode-alist`. --=20 Tu=E1=BA=A5n-Anh Nguy=E1=BB=85n Software Engineer