dotnet-websharper / core

WebSharper - Full-stack, functional, reactive web apps and microservices in F# and C#
https://websharper.com
Apache License 2.0
591 stars 52 forks source link

Investigate/fix error printing #1161

Closed Jand42 closed 2 years ago

Jand42 commented 3 years ago

When doing a build, WebSharper errors do not show up in Visual Studio (tested with 16.10.2 and 17.0.0 Preview 1)

Investigate, ideally both C#/F# WebSharper errors during build should be picked up during build and displayed in both VS/VSCode as red squiggles, maybe WebSharper needs to make changes to match expected printing format again

mrtank commented 2 years ago

For a minimal failing example consider:

[<JavaScript>]
module Client =
    [<Inline "console.log('asd)">]
    let test () = X<unit>

    let Main () =
        test()
        Doc.Empty

Client build fails as expected with WS9001 error. But the squiggle is still missing (VS 2019 Community (non-preview)):

image

(Note that 'asd is not enclosed properly, and this should be reported back to the IDE.)

Jand42 commented 2 years ago

Tested on WS6+VS2022, F# error reporting works. C# error reporting relies on the analyzer so that errors are not double-reported. For fixes on analyzer see #1243.

Jand42 commented 2 years ago

WebSharper error reporting works only partially on on WS6+VS2022. Error is reported, however, we have no code service for F# with WebSharper errors, so error squiggly is hidden by F# code service not reporting the same. I don't see any current workaround other than Roslyn-analyzer like support for F#, which currently only exists for ionide https://github.com/ionide/FSharp.Analyzers.SDK.