Skip to content

Commit 97ccf82

Browse files
committed
Update to use current hlint master
1 parent bb2bf1c commit 97ccf82

File tree

2 files changed

+15
-9
lines changed

2 files changed

+15
-9
lines changed

hie-apply-refact/Haskell/Ide/ApplyRefactPlugin.hs

+13-7
Original file line numberDiff line numberDiff line change
@@ -85,27 +85,33 @@ applyHint file mpos = do
8585
opts = case mpos of
8686
Nothing -> optsf
8787
Just (r,c) -> optsf ++ " --pos " ++ show r ++ "," ++ show c
88-
-- let hlintOpts = [file, "--quiet", "--refactor", "--refactor-options=" ++ opts ]
89-
let hlintOpts = [file, "--quiet" ]
88+
let hlintOpts = [file, "--quiet", "--refactor", "--refactor-options=" ++ opts ]
89+
-- let hlintOpts = [file, "--quiet" ]
9090
logm $ "applyHint=" ++ show hlintOpts
91-
res <- catchException $ hlint hlintOpts
91+
res <- catchException $ runHlint file hlintOpts
9292
logm $ "applyHint:res=" ++ show res
9393
-- res <- hlint hlintOpts
9494
case res of
9595
Left x -> return $ Left (show x)
9696
Right x -> do
97-
let commands = makeApplyRefact x
97+
let commands = makeApplyRefactFromIdeas x
9898
logm $ "applyHint:commands=" ++ show commands
9999
appliedFile <- applyRefactorings mpos commands file
100100
diff <- makeDiffResult file (T.pack appliedFile)
101101
logm $ "applyHint:diff=" ++ show diff
102102
return $ Right diff
103103

104+
runHlint :: FilePath -> [String] -> IO [Idea]
105+
runHlint fileName args = do
106+
(flags, classify, hint) <- argsSettings args
107+
Right m <- parseModuleEx flags fileName Nothing
108+
return $ applyHints classify hint [m]
109+
104110
-- ---------------------------------------------------------------------
105111

106-
makeApplyRefact :: [Suggestion] -> [(String, [Refactoring R.SrcSpan])]
107-
makeApplyRefact suggestions =
108-
map (\(Suggestion i) -> (show i, ideaRefactoring i)) suggestions
112+
makeApplyRefactFromIdeas :: [Idea] -> [(String, [Refactoring R.SrcSpan])]
113+
makeApplyRefactFromIdeas ideas =
114+
map (\i -> (show i, ideaRefactoring i)) ideas
109115

110116
-- ---------------------------------------------------------------------
111117

stack.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ packages:
1818
# commit: bff86be69f556f80a8dcd9dd42774ab77cb00eba
1919
extra-dep: true
2020
- location:
21-
git: https://github.com/alanz/hlint.git
22-
commit: e32f4d3cf32d15003e54d4f42afae7bf06b50168
21+
git: https://github.com/ndmitchell/hlint.git
22+
commit: 9799ad84b1eaaccb1cf926f71dcecaaf3fefc9c9
2323
extra-dep: true
2424
- location:
2525
git: https://github.com/alanz/apply-refact.git

0 commit comments

Comments
 (0)