From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Chinmay Dalal Newsgroups: gmane.emacs.devel Subject: Re: Eglot "inlay hints" landed Date: Fri, 24 Feb 2023 10:34:01 +0530 Message-ID: References: <83edqqaf8c.fsf@gnu.org> <2B284D77-97DF-4B3E-89FB-13F0CA93D240@gmail.com> <87356xv65z.fsf_-_@gmail.com> <87zg94kvoq.fsf@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="14582"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: mu4e 1.9.1; emacs 30.0.50 Cc: Nikola Pajkovsky , emacs-devel@gnu.org, Dimitri Belopopsky , Po Lu , Eli Zaretskii To: =?utf-8?B?Sm/Do28gVMOhdm9yYQ==?= Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Fri Feb 24 07:40:55 2023 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 1pVRlG-0003af-7y for ged-emacs-devel@m.gmane-mx.org; Fri, 24 Feb 2023 07:40:54 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pVRkL-0004ii-Dj; Fri, 24 Feb 2023 01:39:57 -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 1pVQLz-0000pF-9T for emacs-devel@gnu.org; Fri, 24 Feb 2023 00:10:43 -0500 Original-Received: from mail-pl1-x62b.google.com ([2607:f8b0:4864:20::62b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pVQLx-0005Vg-MI; Fri, 24 Feb 2023 00:10:43 -0500 Original-Received: by mail-pl1-x62b.google.com with SMTP id s5so15490082plg.0; Thu, 23 Feb 2023 21:10:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:message-id:in-reply-to:date :subject:cc:to:from:user-agent:references:from:to:cc:subject:date :message-id:reply-to; bh=8Rrg6lK0yTfCuMfEJBsNrEVMJxA4EbD8wxUVMPcyhBc=; b=LHJWX1etp29UVAyfX7E9k17G8bMeU+tr0zKFqWA1gDS6C4GJqArYA10eekex+g62gj cT41GEHz3fKMu6tD4Y3FEJkFYpYktr/koZropnI0QFqDGrITdajnfq2Z78QV/0mwZad+ O3MBlx+YYd2hCE8NX3D0LXv/KW9xXZIJpUaBmvGMsZjjbPX7Hk6OeAHNKhHgaEGI3VBX bpv6Yj3Qz1mGltaVky2iZGMu+G0drXmYA7gng1BONAKSTRL3aJbOTdWoaNqiiPzlWUOI rvEeNdvG08SVxpSwmEGHA9n88UjXSyg2UJrvi7/9P+vOElWSJ63tqszQKGljflYmnI1r GuEA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:in-reply-to:date :subject:cc:to:from:user-agent:references:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=8Rrg6lK0yTfCuMfEJBsNrEVMJxA4EbD8wxUVMPcyhBc=; b=Qgul+sgdo1B2LdgIoah/vmzCUgQ1y0pqroEP1TNC9FqkdqAmPMhwq2LMta/peyvxnI 6CS4cpTxorWow2EMr0zpZqBa7hNXGppOA8b0nw4sKcC6GIGDgYlp6JT9p7PzXCRgC5Ks qC4eaaXm+HNjYe+hPu1vWJDshZ4IORsGNuq+cUlP3M4/2YiznpgZtNlwEbP5vkyXTBg8 i4hDwRxNJQxPHSOZY7dDxHtpJ9P/TycZRBTPXgVzNBcmDjqaxkgSMXACfZvpOkgJfjSK eQh+ptNs0xzzr0sJEmBcv+5/IXbWbiuFOrHOkWbC6dvjgtPt0pdHLQvcAnJycyKe6psA iSGg== X-Gm-Message-State: AO0yUKW4El5iBzW7Zh85r7u0UEGjE4Nz3w3pGXcKwzCbF7OulJOCEBQ4 VgETRNZ163v2ZsLj0UJrjbfS92GPalrNNg== X-Google-Smtp-Source: AK7set9NO2IC3tj6fcpkGqCAzIhcm2w6scICH8uey8mk6L5cNzpZbA+CH36x/reEjtLhEkM9420aIA== X-Received: by 2002:a17:903:2303:b0:19c:c961:ac15 with SMTP id d3-20020a170903230300b0019cc961ac15mr3960913plh.0.1677215438798; Thu, 23 Feb 2023 21:10:38 -0800 (PST) Original-Received: from ganymede ([182.75.45.1]) by smtp.gmail.com with ESMTPSA id v9-20020a1709028d8900b00189e7cb8b89sm1073656plo.127.2023.02.23.21.10.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Feb 2023 21:10:38 -0800 (PST) In-reply-to: Received-SPF: pass client-ip=2607:f8b0:4864:20::62b; envelope-from=dalal.chinmay.0101@gmail.com; helo=mail-pl1-x62b.google.com X-Spam_score_int: 15 X-Spam_score: 1.5 X-Spam_bar: + X-Spam_report: (1.5 / 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_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_SBL_CSS=3.335, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-Mailman-Approved-At: Fri, 24 Feb 2023 01:39:45 -0500 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-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:303739 Archived-At: Chinmay Dalal writes: > Jo=C3=A3o T=C3=A1vora writes: > >> On Thu, Feb 23, 2023 at 7:50 PM Nikola Pajkovsky = wrote: >>> >>> Jo=C3=A3o T=C3=A1vora writes: >>> >>> > I've just landed Eglot "inlay hints" on lisp/progmodes/eglot.el in the >>> > emacs-29 branch. It's a feature that some users (including me) were >>> > looking for for some time. >>> >>> Nice work Jo=C3=A3o! >>> >>> I tried rust inlay hints, and it does not work for me. I bet it's becau= se >>> eglot uses label only if it's string. The same problem was in lsp-mode. >> >> Actually, I think I have code for that. So please show a reproduction >> recipe. I think someone reported here that hints are working >> correctly with rust-analyzer, and I've tried it briefly myself with good >> results. So it must be something else. >> >> Jo=C3=A3o > > > You can look at the end of any long rust function with hl-line-mode on: > there's an empty overlay but it's supposed to have a link to the > beginning of the function. Screenshot attached. > > I think the bug is in eglot--update-hints-1: > > (if (stringp label) label (plist-get label :value)) > > It should instead be the value of :value from the _first element_ of > label, as the spec says a label is a string or a _list of_ `InlayHintLabe= lPart`s: > > https://microsoft.github.io/language-server-protocol/specifications/lsp/3= .17/specification/#inlayHint > > The response from the server is of this form: > > (:position (:line 95 :character 1) > :label [(:value "fn keyboard_interrupt_handler" > :location (:uri "file:///home/chinmay/stuff/rust/blog_os/src/in= terrupts.rs" > :range (:start (:line 67 :character 26) > :end (:line 67 :character 52))))] > :tooltip "fn keyboard_interrupt_handler" > :paddingLeft t > :paddingRight > :json-false) > > > [2. empty overlay --- image/png; swappy-20230224-100015.png]... Of course, this is not ideal when there are multiple elements in the label list (but not strictly wrong either). I raised this point when I opened bug#61412: https://mail.gnu.org/archive/html/bug-gnu-emacs/2023-02/msg00760.html Also, can the clickable link be actually implemented using the `keymap` property of overlays: https://www.gnu.org/software/emacs/manual/html_node/elisp/Special-Propertie= s.html#index-keymap-of-character instead of just displaying the text? Chinmay