diff --git a/src/FsAutoComplete/CodeFixes/NegateBooleanExpression.fs b/src/FsAutoComplete/CodeFixes/NegateBooleanExpression.fs index 133f53f12..f96de4eee 100644 --- a/src/FsAutoComplete/CodeFixes/NegateBooleanExpression.fs +++ b/src/FsAutoComplete/CodeFixes/NegateBooleanExpression.fs @@ -85,6 +85,9 @@ let fix (getParseResultsForFile: GetParseResultsForFile) : CodeFix = Path = path NeedsParensAfterNot = true } + // X.Y() + | SynExpr.App(funcExpr = SynExpr.LongIdent(longDotId = LastIdentFromSynLongIdent ident)) + // X().Y() | SynExpr.App(funcExpr = SynExpr.DotGet(longDotId = LastIdentFromSynLongIdent ident)) diff --git a/test/FsAutoComplete.Tests.Lsp/CodeFixTests/NegateBooleanExpressionTests.fs b/test/FsAutoComplete.Tests.Lsp/CodeFixTests/NegateBooleanExpressionTests.fs index b493f0e4f..16be05b69 100644 --- a/test/FsAutoComplete.Tests.Lsp/CodeFixTests/NegateBooleanExpressionTests.fs +++ b/test/FsAutoComplete.Tests.Lsp/CodeFixTests/NegateBooleanExpressionTests.fs @@ -180,4 +180,24 @@ type X() = let b = not (X().Y())" + testCaseAsync "negate instance member invocation" + <| CodeFix.check + server + " +open System.Collections.Generic + +let foo () = + let dict = dict [] + dict.TryAdd$0(\"foo\", \"bar\") + ()" + Diagnostics.acceptAll + selectCodeFix + " +open System.Collections.Generic + +let foo () = + let dict = dict [] + (not (dict.TryAdd(\"foo\", \"bar\"))) + ()" + ])