[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#62687: 30.0.50; Eglot (eglot--sig-info): SignatureInformation's Docu
From: |
Mekeor Melire |
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 |
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
- 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/05
- bug#62687: 30.0.50; Eglot (eglot--sig-info): SignatureInformation's Documentation is never shown when it's of type MarkupContent,
Mekeor Melire <=
- bug#62687: [PATCH] Eglot: eglot--sig-info: Show SigInfo Docs if Markup; fix regex for highlighting; etc, Mekeor Melire, 2023/04/07
- bug#62687: [PATCH] Eglot: eglot--sig-info: Show SigInfo Docs if Markup; fix regex for highlighting; etc, João Távora, 2023/04/07
- bug#62687: [PATCH] Eglot: eglot--sig-info: Show SigInfo Docs if Markup; fix regex for highlighting; etc, João Távora, 2023/04/07
- bug#62687: [PATCH] Eglot: eglot--sig-info: Show SigInfo Docs if Markup; fix regex for highlighting; etc, Mekeor Melire, 2023/04/08
- bug#62687: [PATCH] Eglot: eglot--sig-info: Show SigInfo Docs if Markup; fix regex for highlighting; etc, João Távora, 2023/04/08
- bug#62687: [PATCH] Eglot: eglot--sig-info: Show SigInfo Docs if Markup; fix regex for highlighting; etc, Mekeor Melire, 2023/04/08
- bug#62687: [PATCH] Eglot: eglot--sig-info: Show SigInfo Docs if Markup; fix regex for highlighting; etc, João Távora, 2023/04/08
- bug#62687: [PATCH] Eglot: eglot--sig-info: Show SigInfo Docs if Markup; fix regex for highlighting; etc, João Távora, 2023/04/08