From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Mekeor Melire Newsgroups: gmane.emacs.bugs Subject: bug#62687: 30.0.50; Eglot (eglot--sig-info): SignatureInformation's Documentation is never shown when it's of type MarkupContent Date: Thu, 06 Apr 2023 20:34:00 +0000 Message-ID: <87sfdcn3h8.fsf@posteo.de> References: <875yaanfuv.fsf@posteo.de> <871qkwolez.fsf@posteo.de> <87wn2on4jj.fsf@posteo.de> 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="22410"; mail-complaints-to="usenet@ciao.gmane.io" Cc: joaotavora@gmail.com To: 62687@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Apr 06 22:49:13 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 1pkWXg-0005an-GN for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 06 Apr 2023 22:49:12 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pkWXZ-0006WF-CV; Thu, 06 Apr 2023 16:49:05 -0400 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 1pkWXX-0006Vg-0P for bug-gnu-emacs@gnu.org; Thu, 06 Apr 2023 16:49:03 -0400 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 1pkWXW-000531-Nd for bug-gnu-emacs@gnu.org; Thu, 06 Apr 2023 16:49:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pkWXW-0006hM-Jf for bug-gnu-emacs@gnu.org; Thu, 06 Apr 2023 16:49:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Mekeor Melire Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 06 Apr 2023 20:49:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 62687 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.168081409925611 (code B ref -1); Thu, 06 Apr 2023 20:49:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 6 Apr 2023 20:48:19 +0000 Original-Received: from localhost ([127.0.0.1]:55291 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pkWWp-0006ex-0N for submit@debbugs.gnu.org; Thu, 06 Apr 2023 16:48:19 -0400 Original-Received: from lists.gnu.org ([209.51.188.17]:55304) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pkWWl-0006eU-J1 for submit@debbugs.gnu.org; Thu, 06 Apr 2023 16:48:17 -0400 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 1pkWWk-0006RQ-Se for bug-gnu-emacs@gnu.org; Thu, 06 Apr 2023 16:48:14 -0400 Original-Received: from mout02.posteo.de ([185.67.36.66]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pkWWi-0004hK-Eo for bug-gnu-emacs@gnu.org; Thu, 06 Apr 2023 16:48:14 -0400 Original-Received: from submission (posteo.de [185.67.36.169]) by mout02.posteo.de (Postfix) with ESMTPS id EEBCB2406F5 for ; Thu, 6 Apr 2023 22:48:09 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.de; s=2017; t=1680814090; bh=g7sbSnmATnTWKkn2AXQbu+YRjvfbX5Pnk/TsBk6REYQ=; h=From:To:Cc:Subject:Date:From; b=fDClXFjvJ+EEb1WFDfEhPq02qrRFDrCTkuaf+InEJYFQ04CscwI+IiVaDpcCncgzj w9C7xsSDL1x/aDVkDF0EJVO7vBRMIrLzTiIKDpi8E86s11drAaDdLXnTMcD2w17RMx unsijr/aErdxFM/xZXipw4ArynuEYpqGKXfLkjYyqWRLTim66ylhlkNVWCi+y5l7pp Gs0MxoDTAYG1aeMUtuxVUWudrE8atF19E7uEFF9MU2osZ09X4yI5soFlu0SJyXnmX1 hQfRx3CAMSrPU9NyDjEWplg93sujAcfyI/lxQ+Z/v1O1hSikSA9vLjKP0AHHcVbjey JJovMq+IH3mpA== Original-Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4Pstqs23P9z9rxL; Thu, 6 Apr 2023 22:48:09 +0200 (CEST) In-reply-to: <87wn2on4jj.fsf@posteo.de> Received-SPF: pass client-ip=185.67.36.66; envelope-from=mekeor@posteo.de; helo=mout02.posteo.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 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, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H2=-0.001, 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:259357 Archived-At: --=-=-= Content-Type: text/plain; format=flowed 2023-04-06 19:49 mekeor@posteo.de: > 2023-04-06 19:21 mekeor@posteo.de: > > (string-match "[[:space:]]*\\([^.\r\n]+[.]?\\)" > > documentation)) > > (setq documentation (match-string 1 documentation)) > > Here, we trim the beginning of the documentation-string and > extract the first sentence; or rather: We extract the text up to > the first dot. > > (I guess here is another bug because this regex will cut > "a().chain().like().this()" (which might occur inside a > documentation-string) off right after the first dot.) > > I guess, the motivation for these lines is to reduce the size of > the echoed documentation message; i.e. prevent flooding of the > echo-area. Large echo-areas take up much of the screen and are > annoying. > > Personally, I don't think that we should extract only one > sentence or so. Instead, I think, `max-mini-window-height' (and > `eldoc-echo-area-use-multiline-p') suffices to configure the > maximum size of the echo-area. > > But, if we decide to stick to the idea of only echoing the first > sentence, then I wonder: How do we implement this feature for > documentation-markups? How to extract the first sentence of a > markup? `string-match' would not work, right? Another idea would be to echo the documentation up to the first newline. That would work especially nice if we stick to use ": " as separator between label and documentation. See below. > > (unless (string-prefix-p (string-trim documentation) label) > > This line makes sure that we do not echo the "first sentence" of > the documentation-string if it's a prefix of the label. How > often does this happen? Has this been reported as a bug before? > It seems rather unlikely to me. > > Also, if we decide to stick to this feature, then I wonder: How > to recreate the logic of `string-prefix-p' for documentations of > type markup? > > > (goto-char (point-max)) > > (insert ": " (eglot--format-markup documentation)))) > > Here, we finally format the "first sentence" of the > documentation-string and insert it into the temporal buffer > which will be echoed later. > > Also, does it make sense to pass a documentation of type string > into `eglot--format-markup' which will format it as > GitHub-Flavored-Markdown (GFM) although the documentation is not > of type markup? Additionally, I don't think that ": " is a good separator between the previously inserted label and the documentation. I think we should use a newline. Alternatively, we could make that separator customizable. But if we decide to stick to ": " as separator, here's a minimal patch that makes Eglot echo the SignatureInformation's Documentation -- even if it's of type MarkupContent: --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=62687.patch diff --git a/lisp/progmodes/eglot.el b/lisp/progmodes/eglot.el index 10b6c0cc2ca..a4f859745e7 100644 --- a/lisp/progmodes/eglot.el +++ b/lisp/progmodes/eglot.el @@ -3128,14 +3128,12 @@ for which LSP on-type-formatting should be requested." (setq params-start (match-beginning 2) params-end (match-end 2)) (add-face-text-property (match-beginning 1) (match-end 1) 'font-lock-function-name-face)) - ;; Decide whether to add one-line-summary to signature line - (when (and (stringp documentation) - (string-match "[[:space:]]*\\([^.\r\n]+[.]?\\)" - documentation)) - (setq documentation (match-string 1 documentation)) - (unless (string-prefix-p (string-trim documentation) label) - (goto-char (point-max)) - (insert ": " (eglot--format-markup documentation)))) + ;; Insert documentation + (goto-char (point-max)) + (unless (null documentation) + (insert ": " (if (stringp documentation) + documentation + (eglot--format-markup documentation)))) ;; Decide what to do with the active parameter... (when (and active-param (< -1 active-param (length parameters))) (eglot--dbind ((ParameterInformation) label documentation) --=-=-=--