File tree Expand file tree Collapse file tree 2 files changed +28
-3
lines changed
src/FsAutoComplete/CodeFixes
test/FsAutoComplete.Tests.Lsp/CodeFixTests Expand file tree Collapse file tree 2 files changed +28
-3
lines changed Original file line number Diff line number Diff line change @@ -81,9 +81,18 @@ let fix (getParseResultsForFile: GetParseResultsForFile) =
81
81
if mfv.IsMemberThisValue then
82
82
return [ mkReplaceFix diagnostic.Range ]
83
83
elif mfv.IsValue then
84
- return
85
- [ tryMkValueReplaceFix diagnostic.Range; tryMkPrefixFix diagnostic.Range ]
86
- |> List.choose id
84
+ let symbolText =
85
+ lines.GetText symbolUse.Range
86
+ |> function
87
+ | Ok r -> r
88
+ | Error _ -> " "
89
+
90
+ if symbolText <> " _" then
91
+ return
92
+ [ tryMkValueReplaceFix diagnostic.Range; tryMkPrefixFix diagnostic.Range ]
93
+ |> List.choose id
94
+ else
95
+ return []
87
96
else
88
97
return []
89
98
| _ -> return []
Original file line number Diff line number Diff line change @@ -1698,6 +1698,22 @@ let private renameUnusedValue state =
1698
1698
"""
1699
1699
( Diagnostics.acceptAll)
1700
1700
selectPrefix
1701
+
1702
+ testCaseAsync " prefix doesn't trigger for _" <|
1703
+ CodeFix.checkNotApplicable server
1704
+ """
1705
+ let $0_ = 6
1706
+ """
1707
+ ( Diagnostics.acceptAll)
1708
+ selectPrefix
1709
+
1710
+ testCaseAsync " replace doesn't trigger for _" <|
1711
+ CodeFix.checkNotApplicable server
1712
+ """
1713
+ let $0_ = 6
1714
+ """
1715
+ ( Diagnostics.acceptAll)
1716
+ selectReplace
1701
1717
])
1702
1718
1703
1719
let private replaceWithSuggestionTests state =
You can’t perform that action at this time.
0 commit comments