ionide / FsAutoComplete

F# language server using Language Server Protocol
Other
412 stars 154 forks source link

add code fix for wildcard _ in pattern match for fs43 on |-> #1157

Open jkone27 opened 1 year ago

jkone27 commented 1 year ago

Suggest | _ -> for match mistaken with infix operator |->

add code fix for wildcard operator suggestion in pattern match for fs43, targets: https://github.com/dotnet/fsharp/issues/15748

as worked in amplifying fsharp session: https://amplifying-fsharp.github.io/sessions/2023/09/01/

WHY

the operator |-> is not defined, so this is usually just a user forgetting to complete the match

HOW

🤖 Generated by Copilot at df83900

baronfel commented 1 year ago

Needs a format but otherwise LGTM.

jkone27 commented 1 year ago

fixed the suggestions, not clear how i run format, can it be added as a git hook at commit phase on master? i am not very familiar with fantomas, would be good if it could be hooked onto dotnet format or .editorconfig i guess most .net devs are familiar with those concepts. formatted the changed files individually with dotnet fantomas filename.fs

nojaf commented 1 year ago

Hi,

Running this target sets up the git hook: https://github.com/fsharp/FsAutoComplete/blob/e3353360771969be51ab3c84a57a432cf41816cf/build/Program.fs#L107-L110

dotnet run --project ./build/build.fsproj -- -t EnsureRepoConfig

And I think it would be nice to see a message when https://github.com/fsharp/FsAutoComplete/blob/e3353360771969be51ab3c84a57a432cf41816cf/Directory.Solution.targets#L10-L12

fails.

Something like Please run "dotnet fantomas src" to format your files. I'm not sure how to do that one with msbuild trickery.

edgarfgp commented 1 year ago

@jkone27 Could you have a look at the conflicts. Seems that this almost ready :)