all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#62687: 30.0.50; Eglot (eglot--sig-info): SignatureInformation's Documentation is never shown when it's of type MarkupContent
@ 2023-04-05 21:17 Mekeor Melire
  2023-04-06 19:21 ` 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
  0 siblings, 2 replies; 21+ messages in thread
From: Mekeor Melire @ 2023-04-05 21:17 UTC (permalink / raw)
  To: 62687

[-- Attachment #1: Type: text/plain, Size: 2544 bytes --]

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?

    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.

    Install Git and Node.js, including NPM.

    Install typescript-language-server:
        npm install --global typescript-language-server

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

    Install the project dependencies:
        npm install

    Open source file with Emacs:
        emacs ./main.ts

    In Emacs, type:
        M-x typescript-ts-mode RET
        M-x eglot RET
        C-3 C-5 C-2 C-f

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

[-- Attachment #2: 2023-04-06-000337_496x610_scrot.png --]
[-- Type: image/png, Size: 59585 bytes --]

[-- Attachment #3: Type: text/plain, Size: 249 bytes --]



[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

^ permalink raw reply	[flat|nested] 21+ messages in thread

end of thread, other threads:[~2023-04-11 13:59 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
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

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.