GNU bug report logs - #61764
29.0.60; eglot show incomplete inlay hints

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: emacs; Reported by: Kai Ma <justksqsf@HIDDEN>; dated Fri, 24 Feb 2023 17:11:02 UTC; Maintainer for emacs is bug-gnu-emacs@HIDDEN.
bug Marked as fixed in versions 29.1. Request was from Kai Ma <justksqsf@HIDDEN> to control <at> debbugs.gnu.org. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 24 Feb 2023 17:10:43 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Feb 24 12:10:43 2023
Received: from localhost ([127.0.0.1]:38159 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1pVbak-00045x-R2
	for submit <at> debbugs.gnu.org; Fri, 24 Feb 2023 12:10:43 -0500
Received: from lists.gnu.org ([209.51.188.17]:57280)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <justksqsf@HIDDEN>) id 1pVbai-00045n-5x
 for submit <at> debbugs.gnu.org; Fri, 24 Feb 2023 12:10:40 -0500
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 <justksqsf@HIDDEN>)
 id 1pVbaa-0000X8-II
 for bug-gnu-emacs@HIDDEN; Fri, 24 Feb 2023 12:10:32 -0500
Received: from mail-pg1-x541.google.com ([2607:f8b0:4864:20::541])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.90_1) (envelope-from <justksqsf@HIDDEN>)
 id 1pVbaW-0001LF-UT
 for bug-gnu-emacs@HIDDEN; Fri, 24 Feb 2023 12:10:30 -0500
Received: by mail-pg1-x541.google.com with SMTP id y19so8015208pgk.5
 for <bug-gnu-emacs@HIDDEN>; Fri, 24 Feb 2023 09:10:25 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112;
 h=mime-version:message-id:date:subject:to:from:from:to:cc:subject
 :date:message-id:reply-to;
 bh=W/E8iqy+sIi/jpEw3q+F73mQp/gSHBR9n37Bj3ROB6A=;
 b=FTbPT5VT1piwDK6DsKKEZPJh2Ks5IM2KAI+9b1VV43MCbsAz/Al7a6TMbNTaQKP6uz
 nu62QLNsi2mzXJ7xDKgqngNbqA9Ab5P0aYxvm65B49/8csTLxQRCWTP9xlJpttRBsdyJ
 tG4FLFtmbOhy0Pi6GZbESxkaDbgSpDHbN5wm1RJhXzfYIeG8jkuc/5zzyno7fJ2/GAbW
 C8LU+5aUds/7jrBmvu3x0HRtOZfP1Cfo++q4xCKmHh57z4TQFsxCLyxDhKa6nuF+11hG
 dXeC9eDO23LYGcJjyCIK/yOnjp/2EeMyYckuUZB5nUOkF5ut8XMhqfd4ulPlhYIzKw5m
 Gg/w==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20210112;
 h=mime-version:message-id:date:subject:to:from:x-gm-message-state
 :from:to:cc:subject:date:message-id:reply-to;
 bh=W/E8iqy+sIi/jpEw3q+F73mQp/gSHBR9n37Bj3ROB6A=;
 b=v8qanYeYS/YlwE+4dotEktQUPMCVGNwIPx6qLni6G6Dxn8BT40UD4rj3tR77zyQlMT
 MAUcRX75N1xbR4pKAWPSjfj0E5sN1+r4xxcDmtyd3ldDtfeYvM9S/jGZDIERlJ4evNXc
 FpUIyrfC+wAPL9DbDpxhSlNHBukRPsYeDiPy75bwTVgboOD8vRDE2IDoR0ExSVgG4gps
 d0jA8xLvcUCdarDfq6h8uLA2Gi5wIeqTyNxh4E9vx9/JerA93BVMWgfYQshvcBfITJIE
 bvU8F7EGKAgBA6Q1TZMBBUO/UkZqyB0rliWWg8zX/riECaRv1zcU8XicrVYReZya7/6K
 xLsg==
X-Gm-Message-State: AO0yUKVYBkWwcf3isOGKcbI7NCES9CuqEWPY/zyM3EMOg9uP9vHaX4Ea
 HlEUT2zWIPw1mxoPiWSrcAGvnGNajaaGrgLe/4s=
X-Google-Smtp-Source: AK7set9L6SYVUi//J2wJ51EBrQQ13axaJL3yM2JhufV5FlnUV3GJQdeftPUDEwqmPrhfL0PxVRcMSQ==
X-Received: by 2002:aa7:8bd0:0:b0:5cd:d766:8a26 with SMTP id
 s16-20020aa78bd0000000b005cdd7668a26mr12525899pfd.8.1677258623683; 
 Fri, 24 Feb 2023 09:10:23 -0800 (PST)
Received: from Kais-MacBook.local ([134.209.106.31])
 by smtp.gmail.com with ESMTPSA id
 m14-20020aa78a0e000000b005a8ae0c52cfsm10230698pfa.16.2023.02.24.09.10.22
 for <bug-gnu-emacs@HIDDEN>
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Fri, 24 Feb 2023 09:10:23 -0800 (PST)
From: Kai Ma <justksqsf@HIDDEN>
To: bug-gnu-emacs@HIDDEN
Subject: 29.0.60; eglot show incomplete inlay hints
Date: Sat, 25 Feb 2023 01:10:19 +0800
Message-ID: <m2h6vbrnus.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain
Received-SPF: pass client-ip=2607:f8b0:4864:20::541;
 envelope-from=justksqsf@HIDDEN; helo=mail-pg1-x541.google.com
X-Spam_score_int: -15
X-Spam_score: -1.6
X-Spam_bar: -
X-Spam_report: (-1.6 / 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,
 FROM_LOCAL_NOVOWEL=0.5, 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-Spam-Score: -0.8 (/)
X-Debbugs-Envelope-To: submit
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.8 (-)

The display of some inlay hints are not complete.  For example, in a
Rust source file:

  let v = vec![1i32];

The expected display is:

  let v: Vec<i32> = ...;

However, the current eglot (commit 55d29c9bacb in branch emacs-29) only
shows the semicolon:

  let v: = ...;

I found that the inlay hint returned by rust-analyzer is something like:

  ([(:value ": ") (:value "Vec" :location ...) (:value "<i32>")])

And I can confirm that by making the following change, the inlay hints
from rust-analyzer will be displayed correctly.

--- a/lisp/progmodes/eglot.el
+++ b/lisp/progmodes/eglot.el
@@ -3549,7 +3549,7 @@ eglot--update-hints-1
                   (left-pad (and paddingLeft (not (memq (char-before) '(32 9)))))
                   (right-pad (and paddingRight (not (memq (char-after) '(32 9)))))
                   (text (if (stringp label)
-                            label (plist-get (elt label 0) :value))))
+                            label (mapconcat (lambda (plist) (plist-get plist :value)) label))))
               (overlay-put ov 'before-string
                            (propertize
                             (concat (and left-pad " ") text (and right-pad " "))

According to the LSP spec [1], the intention of this design is to
support the use case where a LSP client shows different information for
each part.  Therefore, I believe this (concatenation) is the correct
thing to do, regardless of whether eglot supports hovering.

[1] https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#inlayHint

Kai




Acknowledgement sent to Kai Ma <justksqsf@HIDDEN>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs@HIDDEN. Full text available.
Report forwarded to bug-gnu-emacs@HIDDEN:
bug#61764; Package emacs. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Wed, 1 Mar 2023 08:00:02 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.