all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Mekeor Melire <mekeor@posteo.de>
To: 62687@debbugs.gnu.org
Cc: joaotavora@gmail.com
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 19:21:31 +0000	[thread overview]
Message-ID: <871qkwolez.fsf@posteo.de> (raw)
In-Reply-To: <875yaanfuv.fsf@posteo.de>

Sorry for the bad formatting of my bug report. Let me try to send 
the same content a second time, hopefully with better line 
wrapping.


What's the problem?

When you enable eglot-mode from Eglot 1.14; when it then 
successfully connects to a language server; when you then move the 
cursor to "something callable", Eglot is supposed to show the 
Documentation from the SignatureInformation, as specified in the 
language server protocol. This SignatureInformation's 
Documentation can either be of type string, or of type 
MarkupContent [1]. Eglot will never show it, if it's of latter 
type.

Why does this happen?

You enable eglot-mode. Eglot successfully connects to a language 
server. Eglot enables eldoc-mode. When you move the cursor, the 
function `eglot-signature-eldoc-function' is called because it's a 
member of `eldoc-documentation-functions'. This function, 
`eglot-signature-eldoc-function`, calls `eglot--sig-info'. That 
function will only show the documentation if it's of type string 
[2].

--8<---------------cut here---------------start------------->8---
;; 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))))
--8<---------------cut here---------------end--------------->8---

How to see this happen?

1. Install GNU Emacs from master-branch; use any commit after 
"Eglot: Bump to 1.14" 8125d4cfc5605ead9102b7d823c4241029eb76cc. 
You might need to build with tree-sitter and install a tree-sitter 
grammar for typescript, so that you can use `typescript-ts-mode' 
because Emacs has no other mode for typescript.

2. Install Git and Node.js, including NPM.

3. Install typescript-language-server:

    npm install --global typescript-language-server

4. Clone the minimal-reproducing-example:

    git clone 
    https://github.com/mekeor/emacs-eglot-minimal-reproducing-example; 
    cd emacs-eglot-minimal-reproducing-example

5. Install the project dependencies:

    npm install

6. Open source file with Emacs:

    emacs ./main.ts

7. In Emacs, type:

    M-x typescript-ts-mode RET
    M-x eglot RET
    C-3 C-5 C-2 C-f

8. In the echo-area, you will see the type signature of the 
function "fastify.addHook", but there will be no documentation; 
see the attached screenshot.

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

[2] 
https://git.savannah.gnu.org/cgit/emacs.git/tree/lisp/progmodes/eglot.el?id=fa669c4b17c04eff852eb23a6179ccb8fab864db#n3132





  reply	other threads:[~2023-04-06 19:21 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-05 21:17 bug#62687: 30.0.50; Eglot (eglot--sig-info): SignatureInformation's Documentation is never shown when it's of type MarkupContent Mekeor Melire
2023-04-06 19:21 ` Mekeor Melire [this message]
2023-04-06 19:49   ` Mekeor Melire
2023-04-06 20:34     ` Mekeor Melire
2023-04-07 22:40 ` bug#62687: [PATCH] Eglot: eglot--sig-info: Show SigInfo Docs if Markup; fix regex for highlighting; etc Mekeor Melire
2023-04-07 23:49   ` João Távora
2023-04-07 23:53     ` João Távora
2023-04-08 14:35     ` Mekeor Melire
2023-04-08 19:47       ` João Távora
2023-04-08 20:44         ` Mekeor Melire
2023-04-08 21:12           ` João Távora
2023-04-08 22:31             ` João Távora
2023-04-09 21:46               ` Mekeor Melire
2023-04-10  7:14                 ` João Távora
2023-04-10 20:02                   ` Mekeor Melire
2023-04-11 11:16                     ` João Távora
2023-04-11 11:47                       ` Mekeor Melire
2023-04-11 12:56                         ` João Távora
2023-04-11 13:53                           ` João Távora
2023-04-11 13:59                             ` Eli Zaretskii
2023-04-09 22:14             ` Mekeor Melire

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=871qkwolez.fsf@posteo.de \
    --to=mekeor@posteo.de \
    --cc=62687@debbugs.gnu.org \
    --cc=joaotavora@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.