From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Trevor Arjeski Newsgroups: gmane.emacs.bugs Subject: bug#74277: 29.4; rust-ts-mode doesn't highlight some function calls Date: Wed, 20 Nov 2024 21:22:28 +0300 Message-ID: <87ed3522aj.fsf@gmail.com> References: <86bjyookld.fsf@gnu.org> <87r077kl0n.fsf@gmail.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="35845"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: Yuan Fu , Eli Zaretskii , 74277@debbugs.gnu.org, acidbong@tilde.club To: Randy Taylor Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Nov 20 19:24:26 2024 Return-path: Envelope-to: geb-bug-gnu-emacs@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 1tDpNJ-0009FB-O4 for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 20 Nov 2024 19:24:26 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tDpMy-0006sM-TY; Wed, 20 Nov 2024 13:24:05 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tDpMx-0006sD-I5 for bug-gnu-emacs@gnu.org; Wed, 20 Nov 2024 13:24:03 -0500 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tDpMx-0005EM-6i for bug-gnu-emacs@gnu.org; Wed, 20 Nov 2024 13:24:03 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-Version:Date:References:In-Reply-To:From:To:Subject; bh=lKOpJ5lSPulzkV/76StYdK362wu5/dtmT5i3UUzFdHU=; b=m+/cd6cCtufAh5k85gL4R5bU0iBMNHc8KsQZ54KJ6I/5dckrW1HOgyfSim4DCz0D6RFfs4v6DJgzwnx18vKeIIu0xZyCSv87dF9uOX9Gkh/y831UfCL6bspdSXxoiURjuCPGMR1Yg1tuYx3qFnyljuMuw6KOacT1W9j+xEZqGrGSVIlrISZDAvKH6D/Yxsz0hepPDqZJcCLH271mrtJB/e9LOaH0AHmvI4BhVQHJwYjVpC2XPmEEkJva2aypFqee58abbeS0sDgX3amWUuT+NvkN54GflJEm04Gp9+jXtFm+rHP3Aue0RdtMsbfnERSzYBPJ2erDduVC5iSG14irBA==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1tDpMv-0001Ii-W5 for bug-gnu-emacs@gnu.org; Wed, 20 Nov 2024 13:24:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Trevor Arjeski Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 20 Nov 2024 18:24:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 74277 X-GNU-PR-Package: emacs Original-Received: via spool by 74277-submit@debbugs.gnu.org id=B74277.17321270204964 (code B ref 74277); Wed, 20 Nov 2024 18:24:01 +0000 Original-Received: (at 74277) by debbugs.gnu.org; 20 Nov 2024 18:23:40 +0000 Original-Received: from localhost ([127.0.0.1]:47701 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tDpMZ-0001Hz-TZ for submit@debbugs.gnu.org; Wed, 20 Nov 2024 13:23:40 -0500 Original-Received: from mail-lf1-f48.google.com ([209.85.167.48]:50547) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tDpMY-0001Hn-6H for 74277@debbugs.gnu.org; Wed, 20 Nov 2024 13:23:38 -0500 Original-Received: by mail-lf1-f48.google.com with SMTP id 2adb3069b0e04-53a097aa3daso21235e87.1 for <74277@debbugs.gnu.org>; Wed, 20 Nov 2024 10:23:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1732126952; x=1732731752; darn=debbugs.gnu.org; h=mime-version:user-agent:message-id:date:references:in-reply-to :subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to; bh=lKOpJ5lSPulzkV/76StYdK362wu5/dtmT5i3UUzFdHU=; b=OYEJqXUuUcM83++gcoXTAG5/5JMh9QeDQ+StkwgXQi4DpgK7JnEZRYs98I4B/H3HgJ lD6FQreA10WWZIA6uqn+5cnIWQQtGtUpJuMPR9G7zxIJFqt4k/eC52tUZuqDdsec3Wpt 4tGDz/RP0xiWzyBnt2uyfUp4sVeTJ38FTgur/jbVhUFG7NKPtE9nGy59ghKNENQ2c3QC le+5bRsaihadn8PbUcYgoazoxy9sYz2CXv+HZrtAWwvEP66reJFszn/iq+IsXerhbWsc m1hJjku8PZeGkyhRr4tjCchlmMIHc4mKuyIOmAQ6+fZVmAZB7u6oHMJ0U25yLBu4WP46 dJXQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732126952; x=1732731752; h=mime-version:user-agent:message-id:date:references:in-reply-to :subject:cc:to:from:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=lKOpJ5lSPulzkV/76StYdK362wu5/dtmT5i3UUzFdHU=; b=W2S7YQlOYg+DS41CJCNESJMpcxbFgsH1MyShuMxYHvc/m3UTVhV51xJRZmCokOa3my T2uskWLPE+l6dy86CCMUBZOs7ExDFiXsUJEn183hI6FsJX3UQtD19Y3p5j0Y8RRVy1uB vu36jXNRYkPqNVZ879Qb44li2A8PCNRMjBxEtECpMJPsaHK1xZNLQltW9TTGTcts83eI t486dbnczZye3ca2qBJTpVFYXH9JpGKN50si6rWQjyHyBKYu3CZEJNhxoCViUTos0/N0 Cnafi9zQZj0VV+bzpgEJNuVTfdJyOKlllXWLz2PBixC/MwT+LNrSXI/0YwzE/tJ95uQ0 4/Ug== X-Forwarded-Encrypted: i=1; AJvYcCVEyPVIgAxkloFdS29is9yUCv/rwDvF4GGrOgDaaJmAsKtfKnP53HNj4qxYGtxOQ99j6I2Uqg==@debbugs.gnu.org X-Gm-Message-State: AOJu0YzAbPzM0ZnoFPdda+DkFEkdI2aBwWpNJDaWP77BZfksxyf4Zoku Vd5O2kNkEX5+4fSHfn6IDiCzyJf5jFY6pZdecOKVlgfM22xP5RBO X-Google-Smtp-Source: AGHT+IHpUFNovHiFFJKsuPl8ssHvcsUeNej8WD4gcLOJk37DVO5xfkk4hBAVJE1htdR2yeKjBGHPUg== X-Received: by 2002:ac2:4e07:0:b0:53b:2105:1919 with SMTP id 2adb3069b0e04-53dc13338fcmr2194107e87.14.1732126951420; Wed, 20 Nov 2024 10:22:31 -0800 (PST) Original-Received: from trevarch (109-252-36-249.nat.spd-mgts.ru. [109.252.36.249]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-53dbd47817dsm716889e87.229.2024.11.20.10.22.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Nov 2024 10:22:30 -0800 (PST) In-Reply-To: <87r077kl0n.fsf@gmail.com> (Trevor Arjeski's message of "Tue, 19 Nov 2024 23:48:24 +0300") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:295688 Archived-At: --=-=-= Content-Type: text/plain Trevor Arjeski writes: I decided to hack around with this a little bit and found that adding the following lines partially works: --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=rust-ts-mode-macro-highlight.patch Content-Description: rudamentary fix diff --git a/lisp/progmodes/rust-ts-mode.el b/lisp/progmodes/rust-ts-mode.el index e52ea3b125a..508a53d9e32 100644 --- a/lisp/progmodes/rust-ts-mode.el +++ b/lisp/progmodes/rust-ts-mode.el @@ -517,6 +517,19 @@ rust-ts-mode (setq-local syntax-propertize-function #'rust-ts-mode--syntax-propertize) + ;; Injected languages + ;; TODO: add json? + (setq-local treesit-range-settings + (treesit-range-rules + :embed 'rust + :host 'rust + :local t + '((macro_invocation + (token_tree) @capture)))) + + ;; TODO: set this to a useful function + (setq-local treesit-language-at-point-function (lambda (_pos) 'rust)) + ;; Comments. (c-ts-common-comment-setup) --=-=-= Content-Type: text/plain I'm sure there is an issue with solving it this way, I just need someone else more experienced to confirm. It is finicky where it turns the highlighting on and off when you make some code changes, for example adding and removing the semi-colon after the macro invocation. Here is some example code to test it against: fn foo() -> i32 { 4 } fn main() { println!("{:?}", foo()); } Thanks --=-=-=--