Skip to content

Commit

Permalink
Compat with 8.6.5 (and tighten spans for rule suggestions)
Browse files Browse the repository at this point in the history
  • Loading branch information
pepeiborra committed Aug 1, 2020
1 parent 4baf294 commit f576679
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions src/Ide/Plugin/Retrie.hs
Original file line number Diff line number Diff line change
Expand Up @@ -268,8 +268,7 @@ suggestRuleRewrites ::
GHC.Module ->
LRuleDecls pass ->
[(T.Text, CodeActionKind, RunRetrieParams)]
suggestRuleRewrites originatingFile pos ms_mod (L l (HsRules {rds_rules}))
| pos `isInsideSrcSpan` l =
suggestRuleRewrites originatingFile pos ms_mod (L _ (HsRules {rds_rules})) =
concat
[ [ let rewrites =
[Right $ RuleForward (qualify ms_mod ruleName)]
Expand All @@ -286,7 +285,13 @@ suggestRuleRewrites originatingFile pos ms_mod (L l (HsRules {rds_rules}))
RunRetrieParams {..}
)
]
| L _ (HsRule {rd_name = (L _ (_, rn))}) <- rds_rules,
#if MIN_GHC_API_VERSION(8,8,0)
| L l r <- rds_rules,
pos `isInsideSrcSpan` l,
let HsRule {rd_name = L _ (_, rn)} = r,
#else
| let HsRule _ (L _ (_,rn)) _ _ _ _ = r,
#endif
let ruleName = unpackFS rn
]
suggestRuleRewrites _ _ _ _ = []
Expand Down Expand Up @@ -510,9 +515,7 @@ toImportDecl AddImport {..} = GHC.ImportDecl {..}
ideclSourceSrc = NoSourceText
ideclExt = GHC.noExtField
ideclAs = toMod <$> ideclAsString

#if MIN_GHC_API_VERSION(8,10,0)

ideclQualified = if ideclQualifiedBool then GHC.QualifiedPre else GHC.NotQualified
#else
ideclQualified = ideclQualifiedBool
Expand Down

0 comments on commit f576679

Please sign in to comment.