Open jkone27 opened 1 year ago
I see this phenomenon, too. Linux Mint 20.3, VS Code 1.78.2, Ionide 7.5.4. The following code snippet, sent to an FSI terminal, works with dotnet 6.0.488 installed, but not with 7.0.302 or 8.0.100-preview.4.23260.5:
(* ~\~ language=FSharp filename=src/dnlib-testbed.fsx *)
(* ~\~ begin <<lit/dnlib-testbed.md|src/dnlib-testbed.fsx>>[init] *)
#if INTERACTIVE
(* ~\~ begin <<lit/dnlib-testbed.md|import-nugets>>[init] *)
#r "nuget:Microsoft.CodeAnalysis.CSharp"
(* ~\~ end *)
(* ~\~ begin <<lit/dnlib-testbed.md|import-nugets>>[1] *)
#r "nuget:dnlib"
(* ~\~ end *)
(* ~\~ begin <<lit/dnlib-testbed.md|import-nugets>>[2] *)
#r "nuget:spkl.Diffs"
(* ~\~ end *)
(* ~\~ begin <<lit/dnlib-testbed.md|import-nugets>>[3] *)
#r "nuget:xunit"
#r "nuget:Unquote"
(* ~\~ end *)
#endif
(* ~\~ begin <<lit/dnlib-testbed.md|import-ms-codeanalysis>>[init] *)
open Microsoft.CodeAnalysis
open Microsoft.CodeAnalysis.CSharp
(* ~\~ end *)
(* ~\~ begin <<lit/dnlib-testbed.md|import-dnlib>>[init] *)
open dnlib.DotNet
open dnlib.DotNet.Emit
(* ~\~ end *)
(* ~\~ begin <<lit/dnlib-testbed.md|import-spkl-diffs>>[init] *)
open spkl.Diffs
(* ~\~ end *)
(* ~\~ begin <<lit/dnlib-testbed.md|import-dotnet>>[init] *)
open System
open System.IO
open System.Reflection
open System.Collections.Generic
open System.Text.RegularExpressions
(* ~\~ end *)
It seems to be that it's really the block comments that make Ionide trip:
- (* ~\~ end *)
- (* ~\~ begin <<lit/dnlib-testbed.md|impor
error FS0193: Operation is not supported on this platform.
> -dnlib>>[init] *)
I had the same with // comments i think
Does this happen only with NET7 and NET8? can someone else check this? i am on MacOS, is there any way to reproduce in tests if there is tests for comment sections? (comments parsed correctly in FSI by ionide)
https://github.com/ionide/ionide-vscode-fsharp/blob/f7a2887064a93a6321cfd6d35187e3cc52868ba1/src/Components/Fsi.fs#L39 --> do we have a way to add unit tests?
We don't have tests for the Ionide layer itself, but it is possible to test excursions to some degree. I'm not really familiar with it though.
The 'send to FSI' interaction is really simplistic, it's possible that we may need to escape certain syntax when sending it via stdin for example.
Does this happen only with NET7 and NET8? can someone else check this? i am on MacOS, is there any way to reproduce in tests if there is tests for comment sections? (comments parsed correctly in FSI by ionide)
I have seen the phenomenon in different forms on several machines, and on some it doesn't work with dotnet 6.x either (especially if dotnet is installed via the Linux distribution's package manager system).
I have actually set up a new development Linux machine, and the criterion was whether VS Code/Ionide/dotnet (7) "out of the box" do not exhibit the behavior.
i get it also with this script in fsx when running portions with alt/option + enter
open System
type Message = string * AsyncReplyChannel<string>
let replyAgent =
MailboxProcessor<Message>.Start(fun inbox ->
let rec loop () =
async {
let! (message, replyChannel) = inbox.Receive()
replyChannel.Reply(String.Format("Received message: {0}", message))
do! loop ()
}
loop ())
replyAgent.PostAndReply(fun rc -> "Hello", rc)
macos net7 SDK lts
dotnet --version
7.0.401
There are two issues about similar errors in the fsharp repo:
https://github.com/dotnet/fsharp/issues/14160 https://github.com/dotnet/fsharp/issues/14946
I'm able to workaround this by adding the --readline-
parameter to my user settings:
"FSharp.fsiExtraParameters": [
"--readline-"
],
doesn't fully solve for me, the error is gone but in ionide still hangs with no completion, even after #quit;; and re-send to interactive with option/alt + enter
still have this issue... does other people have this? I am on macOS and dotnet 8 latest ionide v7.17.0
Same issue for me when running on linux. It happens when the terminal window is not large enough to fit the sent line. If the line fits, it works fine. Usually I'm experiencing this issue when casting my screen and zooming vscode. Not sure it´s an issue inside ionide or if it's related to this one https://github.com/microsoft/vscode/issues/100225
On Fri, Jan 19, 2024 at 10:53 AM jkone27 @.***> wrote:
image.png (view on web) https://github.com/ionide/ionide-vscode-fsharp/assets/10419217/b3d18acd-6324-4f9c-a45f-890a79fb4d00 still have this issue... does other people have this? I am on macOS and dotnet 8 latest ionide v7.17.0
— Reply to this email directly, view it on GitHub https://github.com/ionide/ionide-vscode-fsharp/issues/1859#issuecomment-1900089560, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAB35CSOSFIXC5H3NI2DJETYPI7B7AVCNFSM6AAAAAAWRKCB6KVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSMBQGA4DSNJWGA . You are receiving this because you are subscribed to this thread.Message ID: @.***>
@Titaye that's really useful info! I had no idea the terminal pane could impact things to this degree.
I can confirm that the size of the terminal can have this impact. I was actually seeing this behaviour without knowing it as I always resized my terminal when a line that I paste in it is too long and not interpreted correctly.
It looks like there may be some API we can use to get the dimensions of the terminal: https://github.com/microsoft/vscode/pull/67919
This might be usable to modify the message we send to make it usable by the terminal.
I don't think we can easily reformat the code sent.
Imagine we have this code:
let x = DateTime(2014, 7, 1, 16, 37, 0, DateTimeKind.Utc).ToString("""r \\\zz""", CultureInfo.InvariantCulture)
^
and the terminal can accept up to the ^
character. How would we cut that line?
Perhaps, detecting the size of the terminal and generating a message box to explain that the terminal is too small or that the line at X is too long is possible solution if we can't reformat the line of code.
in extreme cases we could ask fantomas to reformat it with a given maximum width, but yeah it's probably impossible to do correctly in the general case.
starting to sound like something that we can't truly fix until/unless we move away from dotnet fsi usage directly and into managing a series of FsiEvaluationSessions
inside FSAC or something.
even comments on the screen cause this error (long comments), maybe ionide could have a self-fold option to enable or a tip for users when this message pops out, is very bad for newcomers i think. ps. if you are a newcomer here or in F# and see this error just zoom out in ionide untill all text fits your screen/window, it will go away
cc PR above should solve in all cases for long comments sections (sometimes happens in code), by ignoring comments send to FSI
Describe the bug
I have a compiling script in F#
Steps to reproduce
not clear, but sometimes happens in interactive while running the code with ALT-ENTER, not able to reproduce consistently yet.
Link to sample reproduction
Expected behaviour
no errors as the code is valid F# code
Machine info