-
Notifications
You must be signed in to change notification settings - Fork 154
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Quick fix for removing _ when using a union case with not data #1034
Comments
I would look at https://github.com/fsharp/FsAutoComplete/blob/680a95b9d02c330d5b8a3a459271cc532efb368c/src/FsAutoComplete/CodeFixes/RenameUnusedValue.fs as a good example for this. Generally speaking, a codefix has a trigger, which is often a specific error code, and one or more
module FsAutoComplete.CodeFix.RenameUnusedValue
open FsToolkit.ErrorHandling
open FsAutoComplete.CodeFix
open FsAutoComplete.CodeFix.Types
open FsAutoComplete
open FsAutoComplete.LspHelpers
open FSharp.Compiler.Symbols
open FSharp.UMX
open FSharp.Compiler.Syntax
open FSharp.Compiler.Text
/// describe your fix in short
let fix: CodeFix =
Run.ifDiagnosticByCode (Set.ofList [ YOUR_ERROR_CODE_HERE ]) (fun diagnostic codeActionParams ->
asyncResult {
// logic goes here - return an array of Fix items
})
Hopefully that should give you enough to get started :) |
Thanks for the detailed explanation. I will look into this :) |
Once #1043 is completed we should be able to consume the new warning |
I recently fixed dotnet/fsharp#13851
This will not longer be valid and a new warning error will be reported:
Pattern discard is not allowed for union case that takes no data.
I'm an ionide user and I would love to contribute with some guidance on how to add a quick fix :)
The text was updated successfully, but these errors were encountered: