unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#74807: 30.0.90; Eglot: Non-Markdown strings rendered as Markdown
@ 2024-12-12  0:46 Troy Brown
  2024-12-12  8:30 ` João Távora
  0 siblings, 1 reply; 3+ messages in thread
From: Troy Brown @ 2024-12-12  0:46 UTC (permalink / raw)
  To: 74807; +Cc: Felician Nemeth, João Távora

I've run across a situation where Eglot receives a documentation
string as part of a "completionItem/resolve".  The documentation is
being provided as a regular "string", not MarkupContent, yet it is
being rendered as markup.  Since the string contains characters which
are being interpreted as markdown (e.g., ":"), it causes the
documentation to be rendered incorrectly.

[jsonrpc] e[19:22:22.458]     <-- completionItem/resolve[21]
{"jsonrpc":"2.0","id":21,"result":{"label":"End_Of_Line","documentation":"End
of line sequence: lf | crlf","data":["Format","End_Of_Line"]}}

I believe this is because `eglot-completion-at-point` calls
`eglot--format-markup` for the documentation string provided in the
CompletionItem without first checking to see if it really should be
formatted (i.e., if it is a string it shouldn't be formatted).  While
`eglot--format-markup` will handle strings, it should only be passed
strings which are intended to be markup formated (specified as
MarkedString in the specification).

I believe this issue might affect more than just the documentation
string for CompletionItem, it's possible this also affects other
places which specify fields as "string | MarkupContent" (such as the
SignatureInformation documentation field).





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

* bug#74807: 30.0.90; Eglot: Non-Markdown strings rendered as Markdown
  2024-12-12  0:46 bug#74807: 30.0.90; Eglot: Non-Markdown strings rendered as Markdown Troy Brown
@ 2024-12-12  8:30 ` João Távora
  2024-12-12 13:32   ` Troy Brown
  0 siblings, 1 reply; 3+ messages in thread
From: João Távora @ 2024-12-12  8:30 UTC (permalink / raw)
  To: Troy Brown; +Cc: 74807, felician.nemeth

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

Please provide more of the eglot events log.

Thanks,
João

On Thu, Dec 12, 2024, 00:46 Troy Brown <brownts@troybrown.dev> wrote:

> I've run across a situation where Eglot receives a documentation
> string as part of a "completionItem/resolve".  The documentation is
> being provided as a regular "string", not MarkupContent, yet it is
> being rendered as markup.  Since the string contains characters which
> are being interpreted as markdown (e.g., ":"), it causes the
> documentation to be rendered incorrectly.
>
> [jsonrpc] e[19:22:22.458]     <-- completionItem/resolve[21]
>
> {"jsonrpc":"2.0","id":21,"result":{"label":"End_Of_Line","documentation":"End
> of line sequence: lf | crlf","data":["Format","End_Of_Line"]}}
>
> I believe this is because `eglot-completion-at-point` calls
> `eglot--format-markup` for the documentation string provided in the
> CompletionItem without first checking to see if it really should be
> formatted (i.e., if it is a string it shouldn't be formatted).  While
> `eglot--format-markup` will handle strings, it should only be passed
> strings which are intended to be markup formated (specified as
> MarkedString in the specification).
>
> I believe this issue might affect more than just the documentation
> string for CompletionItem, it's possible this also affects other
> places which specify fields as "string | MarkupContent" (such as the
> SignatureInformation documentation field).
>

[-- Attachment #2: Type: text/html, Size: 2027 bytes --]

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

* bug#74807: 30.0.90; Eglot: Non-Markdown strings rendered as Markdown
  2024-12-12  8:30 ` João Távora
@ 2024-12-12 13:32   ` Troy Brown
  0 siblings, 0 replies; 3+ messages in thread
From: Troy Brown @ 2024-12-12 13:32 UTC (permalink / raw)
  To: João Távora; +Cc: 74807, felician.nemeth

On Thu, Dec 12, 2024 at 3:30 AM João Távora <joaotavora@gmail.com> wrote:
>
> Please provide more of the eglot events log.
>

I wasn't sure how much more of the log you wanted, so I re-ran the
scenario and provided the entire log.

[jsonrpc] D[08:22:58.272] Running language server: ada_language_server
--language-gpr
[jsonrpc] e[08:22:58.272] --> initialize[1]
{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"processId":2262352,"clientInfo":{"name":"Eglot","version":"1.17.30"},"rootPath":"/home/troy/","rootUri":"file:///home/troy","initializationOptions":{},"capabilities":{"workspace":{"applyEdit":true,"executeCommand":{"dynamicRegistration":false},"workspaceEdit":{"documentChanges":true},"didChangeWatchedFiles":{"dynamicRegistration":true},"symbol":{"dynamicRegistration":false},"configuration":true,"workspaceFolders":true},"textDocument":{"synchronization":{"dynamicRegistration":false,"willSave":true,"willSaveWaitUntil":true,"didSave":true},"completion":{"dynamicRegistration":false,"completionItem":{"snippetSupport":true,"deprecatedSupport":true,"resolveSupport":{"properties":["documentation","details","additionalTextEdits"]},"tagSupport":{"valueSet":[1]}},"contextSupport":true},"hover":{"dynamicRegistration":false,"contentFormat":["markdown","plaintext"]},"signatureHelp":{"dynamicRegistration":false,"signatureInformation":{"parameterInformation":{"labelOffsetSupport":true},"documentationFormat":["markdown","plaintext"],"activeParameterSupport":true}},"references":{"dynamicRegistration":false},"definition":{"dynamicRegistration":false,"linkSupport":true},"declaration":{"dynamicRegistration":false,"linkSupport":true},"implementation":{"dynamicRegistration":false,"linkSupport":true},"typeDefinition":{"dynamicRegistration":false,"linkSupport":true},"documentSymbol":{"dynamicRegistration":false,"hierarchicalDocumentSymbolSupport":true,"symbolKind":{"valueSet":[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26]}},"documentHighlight":{"dynamicRegistration":false},"codeAction":{"dynamicRegistration":false,"resolveSupport":{"properties":["edit","command"]},"dataSupport":true,"codeActionLiteralSupport":{"codeActionKind":{"valueSet":["quickfix","refactor","refactor.extract","refactor.inline","refactor.rewrite","source","source.organizeImports"]}},"isPreferredSupport":true},"formatting":{"dynamicRegistration":false},"rangeFormatting":{"dynamicRegistration":false},"rename":{"dynamicRegistration":false},"inlayHint":{"dynamicRegistration":false},"publishDiagnostics":{"relatedInformation":false,"codeDescriptionSupport":false,"tagSupport":{"valueSet":[1,2]}}},"window":{"showDocument":{"support":true},"workDoneProgress":true},"general":{"positionEncodings":["utf-32","utf-8","utf-16"]},"experimental":{}},"workspaceFolders":[{"uri":"file:///home/troy","name":"~/"}]}}
[jsonrpc] e[08:22:58.336] <-- initialize[1]
{"jsonrpc":"2.0","id":1,"result":{"capabilities":{"textDocumentSync":{"openClose":true,"change":1},"completionProvider":{"triggerCharacters":["
",".","'"],"resolveProvider":true},"hoverProvider":true,"declarationProvider":true,"definitionProvider":true,"documentSymbolProvider":{}}}}
[jsonrpc] e[08:22:58.336] --> initialized
{"jsonrpc":"2.0","method":"initialized","params":{}}
[jsonrpc] e[08:22:58.338] --> textDocument/didOpen
{"jsonrpc":"2.0","method":"textDocument/didOpen","params":{"textDocument":{"uri":"file:///home/troy/junk/hello_world.gpr","version":0,"languageId":"gpr","text":"project
Hello_World is\n\n   package Format is\n   end Format;\n\nend
Hello_World;\n"}}}
[jsonrpc] e[08:22:58.338] --> workspace/didChangeConfiguration
{"jsonrpc":"2.0","method":"workspace/didChangeConfiguration","params":{"settings":{}}}
[jsonrpc] e[08:22:58.845] --> textDocument/hover[2]
{"jsonrpc":"2.0","id":2,"method":"textDocument/hover","params":{"textDocument":{"uri":"file:///home/troy/junk/hello_world.gpr"},"position":{"line":3,"character":0}}}
[jsonrpc] e[08:22:59.336] <-- textDocument/publishDiagnostics
{"jsonrpc":"2.0","method":"textDocument/publishDiagnostics","params":{"uri":"file:///home/troy/junk/hello_world.gpr","diagnostics":[]}}
[jsonrpc] e[08:23:00.291] <-- textDocument/hover[2]
{"jsonrpc":"2.0","id":2,"result":null}
[jsonrpc] e[08:23:00.839] --> textDocument/didChange
{"jsonrpc":"2.0","method":"textDocument/didChange","params":{"textDocument":{"uri":"file:///home/troy/junk/hello_world.gpr","version":1},"contentChanges":[{"text":"project
Hello_World is\n\n   package Format is\n\n   end Format;\n\nend
Hello_World;\n"}]}}
[jsonrpc] e[08:23:00.839] --> textDocument/hover[3]
{"jsonrpc":"2.0","id":3,"method":"textDocument/hover","params":{"textDocument":{"uri":"file:///home/troy/junk/hello_world.gpr"},"position":{"line":4,"character":3}}}
[jsonrpc] e[08:23:01.822] <-- textDocument/publishDiagnostics
{"jsonrpc":"2.0","method":"textDocument/publishDiagnostics","params":{"uri":"file:///home/troy/junk/hello_world.gpr","diagnostics":[]}}
[jsonrpc] e[08:23:01.823] <-- textDocument/hover[3]
{"jsonrpc":"2.0","id":3,"result":null}
[jsonrpc] e[08:23:01.839] --> textDocument/didChange
{"jsonrpc":"2.0","method":"textDocument/didChange","params":{"textDocument":{"uri":"file:///home/troy/junk/hello_world.gpr","version":2},"contentChanges":[{"text":"project
Hello_World is\n\n   package Format is\n\n\n   end Format;\n\nend
Hello_World;\n"}]}}
[jsonrpc] e[08:23:01.839] --> textDocument/hover[4]
{"jsonrpc":"2.0","id":4,"method":"textDocument/hover","params":{"textDocument":{"uri":"file:///home/troy/junk/hello_world.gpr"},"position":{"line":4,"character":0}}}
[jsonrpc] e[08:23:02.830] <-- textDocument/publishDiagnostics
{"jsonrpc":"2.0","method":"textDocument/publishDiagnostics","params":{"uri":"file:///home/troy/junk/hello_world.gpr","diagnostics":[]}}
[jsonrpc] e[08:23:02.861] <-- textDocument/hover[4]
{"jsonrpc":"2.0","id":4,"result":null}
[jsonrpc] e[08:23:03.358] --> textDocument/didChange
{"jsonrpc":"2.0","method":"textDocument/didChange","params":{"textDocument":{"uri":"file:///home/troy/junk/hello_world.gpr","version":3},"contentChanges":[{"text":"project
Hello_World is\n\n   package Format is\n\n      \n      \n   end
Format;\n\nend Hello_World;\n"}]}}
[jsonrpc] e[08:23:03.358] --> textDocument/hover[5]
{"jsonrpc":"2.0","id":5,"method":"textDocument/hover","params":{"textDocument":{"uri":"file:///home/troy/junk/hello_world.gpr"},"position":{"line":4,"character":6}}}
[jsonrpc] e[08:23:04.098] --> textDocument/didChange
{"jsonrpc":"2.0","method":"textDocument/didChange","params":{"textDocument":{"uri":"file:///home/troy/junk/hello_world.gpr","version":4},"contentChanges":[{"text":"project
Hello_World is\n\n   package Format is\n\n      for \n      \n   end
Format;\n\nend Hello_World;\n"}]}}
[jsonrpc] e[08:23:04.098] --> textDocument/completion[6]
{"jsonrpc":"2.0","id":6,"method":"textDocument/completion","params":{"textDocument":{"uri":"file:///home/troy/junk/hello_world.gpr"},"position":{"line":4,"character":10},"context":{"triggerKind":2,"triggerCharacter":"
"}}}
[jsonrpc] e[08:23:04.303]   <-- textDocument/publishDiagnostics
{"jsonrpc":"2.0","method":"textDocument/publishDiagnostics","params":{"uri":"file:///home/troy/junk/hello_world.gpr","diagnostics":[]}}
[jsonrpc] e[08:23:04.305]   <-- textDocument/hover[5]
{"jsonrpc":"2.0","id":5,"result":null}
[jsonrpc] i[08:23:04.305] anxious continuation to 5 can't run, held up by (6)
[jsonrpc] e[08:23:04.401]   --> textDocument/hover[7]
{"jsonrpc":"2.0","id":7,"method":"textDocument/hover","params":{"textDocument":{"uri":"file:///home/troy/junk/hello_world.gpr"},"position":{"line":4,"character":10}}}
[jsonrpc] e[08:23:04.568]   <-- textDocument/publishDiagnostics
{"jsonrpc":"2.0","method":"textDocument/publishDiagnostics","params":{"uri":"file:///home/troy/junk/hello_world.gpr","diagnostics":[{"range":{"start":{"line":6,"character":3},"end":{"line":6,"character":3}},"severity":1,"source":"project","message":"Expected
Identifier, got 'end'"}]}}
[jsonrpc] e[08:23:04.573]   <-- textDocument/completion[6]
{"jsonrpc":"2.0","id":6,"result":{"isIncomplete":false,"items":[{"label":"Width","documentation":"Max
line width","data":["Format","Width"]},{"label":"Indentation","documentation":"Indentation
size","data":["Format","Indentation"]},{"label":"Indentation_Kind","documentation":"Indentation
kind: spaces | tabs","data":["Format","Indentation_Kind"]},{"label":"Indentation_Continuation","documentation":"Continuation
Line Indentation
size","data":["Format","Indentation_Continuation"]},{"label":"End_Of_Line","documentation":"End
of line sequence: lf |
crlf","data":["Format","End_Of_Line"]},{"label":"Charset","documentation":"Charset
to use for source decoding","data":["Format","Charset"]}]}}
[jsonrpc] i[08:23:04.573] anxious continuation to 5 running now
[jsonrpc] e[08:23:04.573] <-- textDocument/hover[7]
{"jsonrpc":"2.0","id":7,"result":null}
[jsonrpc] e[08:23:04.585] --> completionItem/resolve[8]
{"jsonrpc":"2.0","id":8,"method":"completionItem/resolve","params":{"label":"Charset","documentation":"Charset
to use for source decoding","data":["Format","Charset"]}}
[jsonrpc] e[08:23:04.590]   <-- completionItem/resolve[8]
{"jsonrpc":"2.0","id":8,"result":{"label":"Charset","documentation":"Charset
to use for source decoding","data":["Format","Charset"]}}
[jsonrpc] e[08:23:06.553] --> textDocument/didChange
{"jsonrpc":"2.0","method":"textDocument/didChange","params":{"textDocument":{"uri":"file:///home/troy/junk/hello_world.gpr","version":5},"contentChanges":[{"text":"project
Hello_World is\n\n   package Format is\n\n      for en\n      \n   end
Format;\n\nend Hello_World;\n"}]}}
[jsonrpc] e[08:23:06.553] --> completionItem/resolve[9]
{"jsonrpc":"2.0","id":9,"method":"completionItem/resolve","params":{"label":"End_Of_Line","documentation":"End
of line sequence: lf | crlf","data":["Format","End_Of_Line"]}}
[jsonrpc] e[08:23:06.743] --> textDocument/didChange
{"jsonrpc":"2.0","method":"textDocument/didChange","params":{"textDocument":{"uri":"file:///home/troy/junk/hello_world.gpr","version":6},"contentChanges":[{"text":"project
Hello_World is\n\n   package Format is\n\n      for end\n      \n
end Format;\n\nend Hello_World;\n"}]}}
[jsonrpc] e[08:23:06.743] --> completionItem/resolve[10]
{"jsonrpc":"2.0","id":10,"method":"completionItem/resolve","params":{"label":"End_Of_Line","documentation":"End
of line sequence: lf | crlf","data":["Format","End_Of_Line"]}}
[jsonrpc] e[08:23:06.823]   <-- textDocument/publishDiagnostics
{"jsonrpc":"2.0","method":"textDocument/publishDiagnostics","params":{"uri":"file:///home/troy/junk/hello_world.gpr","diagnostics":[{"range":{"start":{"line":6,"character":3},"end":{"line":6,"character":3}},"severity":1,"source":"project","message":"Expected
'use', got 'end'"}]}}
[jsonrpc] e[08:23:06.830]   <-- [9]
{"jsonrpc":"2.0","id":9,"result":{"label":"End_Of_Line","documentation":"End
of line sequence: lf | crlf","data":["Format","End_Of_Line"]}}
[jsonrpc] i[08:23:06.830] [9] Response to request 9 which has been canceled
[jsonrpc] e[08:23:07.076]   <-- textDocument/publishDiagnostics
{"jsonrpc":"2.0","method":"textDocument/publishDiagnostics","params":{"uri":"file:///home/troy/junk/hello_world.gpr","diagnostics":[{"range":{"start":{"line":4,"character":10},"end":{"line":4,"character":10}},"severity":1,"source":"project","message":"Expected
Identifier, got 'end'"}]}}
[jsonrpc] e[08:23:07.105]   <-- completionItem/resolve[10]
{"jsonrpc":"2.0","id":10,"result":{"label":"End_Of_Line","documentation":"End
of line sequence: lf | crlf","data":["Format","End_Of_Line"]}}
[jsonrpc] e[08:23:07.245] --> textDocument/hover[11]
{"jsonrpc":"2.0","id":11,"method":"textDocument/hover","params":{"textDocument":{"uri":"file:///home/troy/junk/hello_world.gpr"},"position":{"line":4,"character":13}}}
[jsonrpc] e[08:23:07.257] <-- textDocument/hover[11]
{"jsonrpc":"2.0","id":11,"result":null}
[jsonrpc] e[08:23:08.466] --> textDocument/didChange
{"jsonrpc":"2.0","method":"textDocument/didChange","params":{"textDocument":{"uri":"file:///home/troy/junk/hello_world.gpr","version":7},"contentChanges":[{"text":"project
Hello_World is\n\n   package Format is\n\n      for end_of\n      \n
end Format;\n\nend Hello_World;\n"}]}}
[jsonrpc] e[08:23:08.466] --> textDocument/hover[12]
{"jsonrpc":"2.0","id":12,"method":"textDocument/hover","params":{"textDocument":{"uri":"file:///home/troy/junk/hello_world.gpr"},"position":{"line":4,"character":16}}}
[jsonrpc] e[08:23:08.725] <-- textDocument/publishDiagnostics
{"jsonrpc":"2.0","method":"textDocument/publishDiagnostics","params":{"uri":"file:///home/troy/junk/hello_world.gpr","diagnostics":[{"range":{"start":{"line":6,"character":3},"end":{"line":6,"character":3}},"severity":1,"source":"project","message":"Expected
'use', got 'end'"}]}}
[jsonrpc] e[08:23:08.727] <-- textDocument/hover[12]
{"jsonrpc":"2.0","id":12,"result":null}
[jsonrpc] e[08:23:09.013] --> textDocument/didChange
{"jsonrpc":"2.0","method":"textDocument/didChange","params":{"textDocument":{"uri":"file:///home/troy/junk/hello_world.gpr","version":8},"contentChanges":[{"text":"project
Hello_World is\n\n   package Format is\n\n      for End_Of_Line\n
\n   end Format;\n\nend Hello_World;\n"}]}}
[jsonrpc] e[08:23:09.281] <-- textDocument/publishDiagnostics
{"jsonrpc":"2.0","method":"textDocument/publishDiagnostics","params":{"uri":"file:///home/troy/junk/hello_world.gpr","diagnostics":[{"range":{"start":{"line":6,"character":3},"end":{"line":6,"character":3}},"severity":1,"source":"project","message":"Expected
'use', got 'end'"}]}}
[jsonrpc] e[08:23:09.518] --> textDocument/hover[13]
{"jsonrpc":"2.0","id":13,"method":"textDocument/hover","params":{"textDocument":{"uri":"file:///home/troy/junk/hello_world.gpr"},"position":{"line":4,"character":21}}}
[jsonrpc] e[08:23:09.531] <-- textDocument/hover[13]
{"jsonrpc":"2.0","id":13,"result":null}





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

end of thread, other threads:[~2024-12-12 13:32 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-12-12  0:46 bug#74807: 30.0.90; Eglot: Non-Markdown strings rendered as Markdown Troy Brown
2024-12-12  8:30 ` João Távora
2024-12-12 13:32   ` Troy Brown

Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).