add code fix for wildcard _ in pattern match for fs43 on |->#1157
add code fix for wildcard _ in pattern match for fs43 on |->#1157jkone27 wants to merge 5 commits intoionide:mainfrom
Conversation
TheAngryByrd
left a comment
There was a problem hiding this comment.
@dawedawe mentioned some good fixes
Co-authored-by: dawe <dawedawe@posteo.de>
remove comments
|
Needs a format but otherwise LGTM. |
|
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 |
|
Hi, Running this target sets up the git hook:
And I think it would be nice to see a message when fails. Something like |
|
@jkone27 Could you have a look at the conflicts. Seems that this almost ready :) |
|
/repo-assist can you rebase this PR |
|
🤖 This is an automated response from Repo Assist. Hi @jkone27! I've completed the rebase analysis for this PR. Unfortunately I'm unable to force-push the rebased branch directly (rebasing rewrites commit history which requires a force push), but I've worked through all the conflicts and can share exactly what needs to change. Rebase SummaryThe PR has 5 commits that cherry-pick cleanly onto current Key changes needed to bring this PR up to date:1. 2. 3. AddMissingFunKeyword.fix forceFindSourceText getLineText
+ AddMissingWildcardOperator.fix tryGetParseAndCheckResultsForFile
MakeOuterBindingRecursive.fix tryGetParseAndCheckResultsForFile getLineText4. - ExprTypeMismatchTests.tests state ]
+ ExprTypeMismatchTests.tests state
+ AddMissingWildcardOperatorTests.tests state ]5. Quick rebase commandsgit fetch upstream main
git rebase upstream/main
# Resolve conflicts as described above, then:
git push --force-with-lease origin fix-dotnet-fsharp-15748-amplifying-fsharpThe new files ( Let me know if you'd like any help! 🙂
|
|
/repo-assist rebase changes from this PR and push them as new PR |
Rebased changes from PR #1157 by @jkone27 onto current main. Adds a code fix that suggests replacing the invalid infix operator '|->' with the correct wildcard pattern '| _ ->' in a match expression when the F# compiler diagnostic FS0043 is raised. Closes #1157 Co-authored-by: jkone27 <10419217+jkone27@users.noreply.github.com> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
Pull request created: #1472
|
|
🤖 This is an automated response from Repo Assist. Done! I've rebased the changes from this PR onto current The following adaptations were made:
The build succeeds ✅. The new PR is ready for review.
|
|
Thanks a lot for this, and sorry it took us so long to merge it |
… for FS0043 (#1472) * feat: add code fix for wildcard _ in pattern match for FS0043 Rebased changes from PR #1157 by @jkone27 onto current main. Adds a code fix that suggests replacing the invalid infix operator '|->' with the correct wildcard pattern '| _ ->' in a match expression when the F# compiler diagnostic FS0043 is raised. Closes #1157 Co-authored-by: jkone27 <10419217+jkone27@users.noreply.github.com> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * ci: trigger CI checks --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: jkone27 <10419217+jkone27@users.noreply.github.com> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Suggest
| _ ->for match mistaken with infix operator|->add code fix for wildcard operator suggestion in pattern match for fs43, targets:
dotnet/fsharp#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
FsAutoComplete.CodeFix.AddMissingWildcardOperatorinsrc/FsAutoComplete/CodeFixes/AddMissingWildcardOperator.fsand its signature file insrc/FsAutoComplete/CodeFixes/AddMissingWildcardOperator.fsi(link, link)CodeFixtype and theSyntaxVisitorBaseandSyntaxTraversalutilities (link, link)AdaptiveFSharpLspServertype insrc/FsAutoComplete/LspServers/AdaptiveFSharpLspServer.fs(link)FSharpLspServertype insrc/FsAutoComplete/LspServers/FsAutoComplete.Lsp.fs(link)FsAutoComplete.Tests.CodeFixTests.AddMissingWildcardOperatorTestsintest/FsAutoComplete.Tests.Lsp/CodeFixTests/AddMissingWildcardOperatorTests.fs(link)CodeFixandDiagnosticsutilities (link)testsfunction intest/FsAutoComplete.Tests.Lsp/CodeFixTests/Tests.fs(link)