From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Kai Ma Newsgroups: gmane.emacs.bugs Subject: bug#61764: 29.0.60; eglot show incomplete inlay hints Date: Sat, 25 Feb 2023 01:10:19 +0800 Message-ID: Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="18438"; mail-complaints-to="usenet@ciao.gmane.io" To: 61764@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri Feb 24 18:11:23 2023 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 1pVbbO-0004cN-UZ for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 24 Feb 2023 18:11:22 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pVbbA-0000ig-7R; Fri, 24 Feb 2023 12:11:08 -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 1pVbb6-0000i4-HU for bug-gnu-emacs@gnu.org; Fri, 24 Feb 2023 12:11:04 -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 1pVbb4-0001PM-Oi for bug-gnu-emacs@gnu.org; Fri, 24 Feb 2023 12:11:03 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pVbb4-00046X-KD for bug-gnu-emacs@gnu.org; Fri, 24 Feb 2023 12:11:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Kai Ma Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 24 Feb 2023 17:11:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 61764 X-GNU-PR-Package: emacs X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.167725864315749 (code B ref -1); Fri, 24 Feb 2023 17:11:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 24 Feb 2023 17:10:43 +0000 Original-Received: from localhost ([127.0.0.1]:38159 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pVbak-00045x-R2 for submit@debbugs.gnu.org; Fri, 24 Feb 2023 12:10:43 -0500 Original-Received: from lists.gnu.org ([209.51.188.17]:57280) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pVbai-00045n-5x for submit@debbugs.gnu.org; Fri, 24 Feb 2023 12:10:40 -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 1pVbaa-0000X8-II for bug-gnu-emacs@gnu.org; Fri, 24 Feb 2023 12:10:32 -0500 Original-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 ) id 1pVbaW-0001LF-UT for bug-gnu-emacs@gnu.org; Fri, 24 Feb 2023 12:10:30 -0500 Original-Received: by mail-pg1-x541.google.com with SMTP id y19so8015208pgk.5 for ; 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) Original-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 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Feb 2023 09:10:23 -0800 (PST) Received-SPF: pass client-ip=2607:f8b0:4864:20::541; envelope-from=justksqsf@gmail.com; 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-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:256642 Archived-At: 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 = ...; 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 "")]) 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