FsAutoComplete
FsAutoComplete copied to clipboard
add code fix for wildcard _ in pattern match for fs43 on |->
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
- Add a new code fix for adding a missing wildcard operator to a match expression (link, link)
- Define a new module
FsAutoComplete.CodeFix.AddMissingWildcardOperator
insrc/FsAutoComplete/CodeFixes/AddMissingWildcardOperator.fs
and its signature file insrc/FsAutoComplete/CodeFixes/AddMissingWildcardOperator.fsi
(link, link) - Export a title, a function to try to find the pattern that needs the fix, and a function to apply the fix using the
CodeFix
type and theSyntaxVisitorBase
andSyntaxTraversal
utilities (link, link)
- Define a new module
- Register the new code fix function in the language server implementations (link, link)
- Add a test case for the new code fix using the test helpers (link, link)
- Define a new test module
FsAutoComplete.Tests.CodeFixTests.AddMissingWildcardOperatorTests
intest/FsAutoComplete.Tests.Lsp/CodeFixTests/AddMissingWildcardOperatorTests.fs
(link) - Check that the code fix can suggest a wildcard pattern for a missing match case in a simple example using the
CodeFix
andDiagnostics
utilities (link) - Add the new test module to the list of test modules in the
tests
function intest/FsAutoComplete.Tests.Lsp/CodeFixTests/Tests.fs
(link)
- Define a new test module