Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions plugins/hls-tactics-plugin/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,19 @@ fill hole" code action, *et voila!*
[hls]: https://github.com/haskell/haskell-language-server/releases


## Usage

When enabled, Wingman for Haskell will remove HLS support for hole-fit code
actions. These code actions are provided by GHC and make typechecking extremely
slow in the presence of typed holes. Because Wingman relies so heavily on typed
holes, these features are in great tension.

The solution: we just remove the hole-fit actions. They are mostly subsumed by
Wingman, and usually make extremely unhelpful suggestions, such as `replace _
with id _`. If you'd prefer to use these actions, you can get them back by
disabling Wingman.


## Editor Configuration

### Enabling Jump to Hole
Expand Down
9 changes: 8 additions & 1 deletion plugins/hls-tactics-plugin/src/Wingman/StaticPlugin.hs
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,16 @@ staticPlugin :: DynFlagsModifications
staticPlugin = mempty
{ dynFlagsModifyGlobal =
\df -> allowEmptyCaseButWithWarning
$ flip gopt_unset Opt_SortBySubsumHoleFits
$ df
{ refLevelHoleFits = Just 0
, maxRefHoleFits = Just 0
, maxValidHoleFits = Just 0
#if __GLASGOW_HASKELL__ >= 808
, staticPlugins = staticPlugins df <> [metaprogrammingPlugin]
#endif
}
#if __GLASGOW_HASKELL__ >= 808
{ staticPlugins = staticPlugins df <> [metaprogrammingPlugin] }
, dynFlagsModifyParser = enableQuasiQuotes
#endif
}
Expand Down
5 changes: 4 additions & 1 deletion test/functional/FunctionalCodeAction.hs
Original file line number Diff line number Diff line change
Expand Up @@ -397,8 +397,10 @@ redundantImportTests = testGroup "redundant import code actions" [
]
]


typedHoleTests :: TestTree
typedHoleTests = testGroup "typed hole code actions" [
ignoreTestBecause "Wingman changes the result of this test and I don't know how to disable Wingman" $
testCase "works" $
runSession hlsCommand fullCaps "test/testdata" $ do
doc <- openDoc "TypedHoles.hs" "haskell"
Expand All @@ -419,7 +421,8 @@ typedHoleTests = testGroup "typed hole code actions" [
, "foo x = maxBound"
]

, testCase "shows more suggestions" $
, ignoreTestBecause "Wingman changes the result of this test and I don't know how to disable Wingman" $
testCase "shows more suggestions" $
runSession hlsCommand fullCaps "test/testdata" $ do
doc <- openDoc "TypedHoles2.hs" "haskell"
_ <- waitForDiagnosticsFromSource doc "typecheck"
Expand Down