ionide-vscode-fsharp icon indicating copy to clipboard operation
ionide-vscode-fsharp copied to clipboard

Unusual characters in Ionide tooltip

Open Darkle opened this issue 1 year ago • 1 comments

Describe the bug

Unusual characters are appearing in the vscode tooltips when using Ionide.

Steps to reproduce

  1. Type something like asd in your code
  2. Hover over it
  3. You should see odd characters in the tooltip

Screenshots

  • ss-vsc
  • Discord user Christian's screenshot: image

Machine info

  • OS: debian linux bullseye
  • .NET SDK version: 7.0.401
  • Ionide version: v7.12.4
  • vscode 1.82.2

Additional context

https://discord.com/channels/196693847965696000/524660202864377896/1157997202128519188

Darkle avatar Oct 01 '23 21:10 Darkle

I would consider this a compiler bug. Some new error message are "semi-formatted" (including newlines). I don't think they should be.

Martin521 avatar Nov 24 '23 16:11 Martin521

Some additional context; it doesn't seem to happen in .fsx files: https://discord.com/channels/196693847965696000/524660202864377896/1229726085546119200

Darkle avatar Apr 16 '24 09:04 Darkle

The character is a UnicodeCategory.ParagraphSeparator so I guess, it is a preformatted diagnostic as stated by @Martin521 On fs files it is a ParagraphSeparator but a regular \n on fsi files.

From what I see, it's directly coming from "F# Compiler" diagnostics https://github.com/ionide/FsAutoComplete/blob/bc827fb748e9b38615dda6f51732072e56bfdb1f/src/FsAutoComplete/LspServers/AdaptiveServerState.fs#L485-L488

A few questions :

  • can we reformat the message with linebreaks in FSAC https://github.com/ionide/FsAutoComplete/blob/main/src/FsAutoComplete/LspHelpers.fs#L101-L116 ?
  • if yes, should it impact all IDE relying on FSAC ? (ex: does ionide-vim handle ParagraphSeparator properly or is also impacted by this issue ?)
  • or should it be fixed directly in compiler ?

MrLuje avatar Apr 16 '24 12:04 MrLuje

Good investigation @MrLuje! I think we can approach this in a few places:

  • Do the newline replacement on the message in FSAC
  • Raise an issue/discussion on dotnet/fsharp for clarification about the intent here
  • Longer term, this particular event could be moved to the new infrastructure that @nojaf and others have created where the diagnostic can contain data that would provide the suggestions directly instead of us having to format the new lines.

baronfel avatar Apr 16 '24 13:04 baronfel