From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Pankaj Jangid Newsgroups: gmane.emacs.bugs Subject: bug#59214: [PATCH] Alternate rust-analyzer command added Date: Thu, 17 Nov 2022 11:27:31 +0530 Message-ID: <87sfiirulw.fsf@xyz.invalid> References: <87o7tc2xu8.fsf@codeisgreat.org> <83leoag78l.fsf@gnu.org> <83fseig0h0.fsf@gnu.org> 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="39398"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: 59214@debbugs.gnu.org, Eli Zaretskii To: =?UTF-8?Q?Jo=C3=A3o_?= =?UTF-8?Q?T=C3=A1vora?= Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Nov 17 06:58:16 2022 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 1ovXuh-0009yU-58 for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 17 Nov 2022 06:58:15 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ovXuW-0007l7-Dz; Thu, 17 Nov 2022 00:58:04 -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 1ovXuU-0007kX-LR for bug-gnu-emacs@gnu.org; Thu, 17 Nov 2022 00:58:02 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ovXuU-00036W-BJ for bug-gnu-emacs@gnu.org; Thu, 17 Nov 2022 00:58:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1ovXuU-0002nU-8y for bug-gnu-emacs@gnu.org; Thu, 17 Nov 2022 00:58:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Pankaj Jangid Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 17 Nov 2022 05:58:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 59214 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 59214-submit@debbugs.gnu.org id=B59214.166866466310711 (code B ref 59214); Thu, 17 Nov 2022 05:58:02 +0000 Original-Received: (at 59214) by debbugs.gnu.org; 17 Nov 2022 05:57:43 +0000 Original-Received: from localhost ([127.0.0.1]:58819 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ovXuB-0002mg-AW for submit@debbugs.gnu.org; Thu, 17 Nov 2022 00:57:43 -0500 Original-Received: from mail-pj1-f49.google.com ([209.85.216.49]:55964) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ovXu9-0002mR-3d for 59214@debbugs.gnu.org; Thu, 17 Nov 2022 00:57:41 -0500 Original-Received: by mail-pj1-f49.google.com with SMTP id k5so738985pjo.5 for <59214@debbugs.gnu.org>; Wed, 16 Nov 2022 21:57:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=codeisgreat-org.20210112.gappssmtp.com; s=20210112; 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=jTiYfV4Bmw6UwhEBbrGCJRZfyfjAzaBdW69jfqtDG9I=; b=rWK0YM4TzREjKowmBQzowN39KBrkZg9AyNXQ+g7VIs40KSnyERZxh4jal3laf9lizZ KT4qf4RxjTnFb83I1kPpPiZ6makinOEiLgKx9bPLwYDj3mIe5WuXR7nYCdntQFJORLh5 4qi2y3LYhTo3Y5tP6Rwg1cnUUXYU4XWl9/IfUu6PLfU3t+MFiE/UyWEyxnyLzJvi7M6H HMjH3aVUeFbekEuqzO3gTKjydPDg7GQ0ebE7fqzFqN29aDEbFjrciis7e4GXwxja7cRV 3qtn2hkAv3zRBSqCrNSJF/ac0LSAtgZsYoB3hwFD/HcF10ammsqu3t8iNROh5QXLngGT CpgQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=jTiYfV4Bmw6UwhEBbrGCJRZfyfjAzaBdW69jfqtDG9I=; b=nADsn17PMHXpk6Hzh0ZdPcjQzFeAJmQ7E7fosGwxkTzWB83mb+JB+Sd/gkGoY/8h6d QseTqTn2g4j14QdHaIr0edS+4YIH3OOEP4wdRGIsZW1kJO9PCNisXW/RbHdE1LQajKLz lVrX0vEftMowDhaegr8KIbzDfIYpqxBgYGRwq/x/K3PMCV4yGEC86KPmIv0lwcBpTPoT ea6nYF/jHg8vIied8BiAYK0xBMp+KLXJbBePdxTQLMN/V4hV0DbAExhiH+eMzpXfJyLY ZazjwTXdXuogoJWX/8knGVKqaMlq2uVuO3eayR8LJ/1rQqb91cMAt+gPnZ/QI1csy1y8 SFzQ== X-Gm-Message-State: ANoB5pnAWN9VXeMJulALGcQAizbqNUEQgjH5F06EGQRkzA5GyBkKVZcR dDxMSkXG2ZYWt2ElERevBB+eKKtuqyiaXw== X-Google-Smtp-Source: AA0mqf6bn783ynEE7XyiCkCHyCLnN/pAnLWlkaoht/EF38VkBTL2/RGVSK1tTcfIz3e82vNLepuWiQ== X-Received: by 2002:a17:90a:c286:b0:212:2098:fd2f with SMTP id f6-20020a17090ac28600b002122098fd2fmr1240771pjt.162.1668664655105; Wed, 16 Nov 2022 21:57:35 -0800 (PST) Original-Received: from anant ([49.36.236.45]) by smtp.gmail.com with ESMTPSA id c17-20020a170902d49100b00187033cac81sm216523plg.145.2022.11.16.21.57.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Nov 2022 21:57:34 -0800 (PST) In-Reply-To: ("=?UTF-8?Q?Jo=C3=A3o_?= =?UTF-8?Q?T=C3=A1vora?="'s message of "Wed, 16 Nov 2022 21:06:06 +0000") 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:248082 Archived-At: --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Jo=C3=A3o T=C3=A1vora writes: > Pankaj, is it really that uncommon to have a tool installed as part of > a Rust package be in the execution path of a shell? It's not uncommon > in other toolchains with what I think are similar package architectures, > such as Node JS. Perhaps I wasn't clear enough. The rust toolchain is similar to the tools of NodeJS world. Both try to install packages/components in a standardised location. And users are not required to move files and create links manually using OS level commands like `cp', `ln' etc. `npm' and `rustup' commands do that for users. >From the rust users mailing, as far as I have understood, the maintainers are seeing `rust-analyzer' as a replacement for `rls'. And `rust-analyzer' was recently moved from `nightly' to `stable'. They have not yet placed `rust-analyzer' executable in PATH/exec-path, possibly because they don't want to keep two executables for the same job. Or may be they are thinking of keeping the name `rls'. Not sure though. But `rustup run stable rust-analyzer' will work in all cases. So my recommendation is that we keep just the `rustup' version and `rls' as fallback. I have attached the updated patch. --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=0001-Invoke-rust-analyzer-using-rustup.patch >From 727e362e142ae3d292bf7abed3b592e0dff36725 Mon Sep 17 00:00:00 2001 From: Pankaj Jangid Date: Thu, 17 Nov 2022 11:25:16 +0530 Subject: [PATCH] Invoke rust-analyzer using rustup * lisp/progmodes/eglot.el (eglot-server-programs): There are two ways to run rust-analyzer. After adding the rustup component, users can add rust-analyzer executable to PATH/exec-path using OS level `cp' or `ln' commands and then run rust-analyzer directly or they may run ``rustup run stable rust-analyzer'' command without making PATH changes. 2nd command is the preferred way to invoke the language server because it doesn't require user to manually create link inside `~/.cargo/bin'. --- lisp/progmodes/eglot.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lisp/progmodes/eglot.el b/lisp/progmodes/eglot.el index 12808e80c4..fb95313aa0 100644 --- a/lisp/progmodes/eglot.el +++ b/lisp/progmodes/eglot.el @@ -181,7 +181,7 @@ eglot-alternatives when probe return (cons probe args) finally (funcall err))))))) -(defvar eglot-server-programs `((rust-mode . ,(eglot-alternatives '("rust-analyzer" "rls"))) +(defvar eglot-server-programs `((rust-mode . ,(eglot-alternatives '(("rustup" "run" "stable" "rust-analyzer") "rls"))) (cmake-mode . ("cmake-language-server")) (vimrc-mode . ("vim-language-server" "--stdio")) (python-mode -- 2.30.2 --=-=-=--