Skip to content
This repository was archived by the owner on Oct 7, 2020. It is now read-only.

Commit 3d77363

Browse files
committed
Demote from top-level definition
1 parent 0af5c3e commit 3d77363

File tree

2 files changed

+22
-21
lines changed

2 files changed

+22
-21
lines changed

src/Haskell/Ide/Engine/Plugin/HsImport.hs

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -84,42 +84,42 @@ importModule uri modName = pluginGetFile "hsimport cmd: " uri $ \origInput -> do
8484
plugins <- getPlugins
8585
let mprovider = Hie.getFormattingPlugin config plugins
8686
case mprovider of
87-
Nothing ->
87+
Nothing ->
8888
return $ IdeResultOk (J.WorkspaceEdit mChanges mDocChanges)
8989

9090
Just (plugin, _) -> do
9191
newChanges <- forM mChanges $ \change -> do
9292
let func = mapM (formatTextEdit plugin)
9393
res <- mapM func change
94-
return $ fmap flatten res
94+
return $ fmap flatten res
9595

9696
newDocChanges <- forM mDocChanges $ \change -> do
9797
let cmd (J.TextDocumentEdit vids edits) = do
9898
newEdits <- mapM (formatTextEdit plugin) edits
9999
return $ J.TextDocumentEdit vids (flatten newEdits)
100100
mapM cmd change
101101

102-
return $ IdeResultOk
103-
(J.WorkspaceEdit newChanges
104-
newDocChanges
105-
)
106-
else
107-
return $ IdeResultOk (J.WorkspaceEdit mChanges mDocChanges)
102+
return
103+
$ IdeResultOk (J.WorkspaceEdit newChanges newDocChanges)
104+
else return $ IdeResultOk (J.WorkspaceEdit mChanges mDocChanges)
108105

109106
where
110-
flatten :: List [a] -> List a
111-
flatten (J.List list) = J.List (join list)
112-
113-
formatTextEdit :: PluginDescriptor -> J.TextEdit -> IdeGhcM [J.TextEdit]
114-
formatTextEdit plugin edit@(J.TextEdit r t) = do
115-
result <- runPluginCommand
116-
(pluginId plugin)
117-
"formatText"
118-
-- TODO: should this be in the configs?
119-
(dynToJSON $ toDynJSON $ FormatTextCmdParams t r (FormattingOptions 2 True))
120-
return $ case result of
121-
IdeResultOk e -> fromMaybe [edit] (fromDynJSON e)
122-
_ -> [edit]
107+
flatten :: List [a] -> List a
108+
flatten (J.List list) = J.List (join list)
109+
110+
formatTextEdit :: PluginDescriptor -> J.TextEdit -> IdeGhcM [J.TextEdit]
111+
formatTextEdit plugin edit@(J.TextEdit r t) = do
112+
result <- runPluginCommand
113+
(pluginId plugin)
114+
"formatText"
115+
-- TODO: should this be in the configs?
116+
(dynToJSON $ toDynJSON $ FormatTextCmdParams t
117+
r
118+
(FormattingOptions 2 True)
119+
)
120+
return $ case result of
121+
IdeResultOk e -> fromMaybe [edit] (fromDynJSON e)
122+
_ -> [edit]
123123

124124
codeActionProvider :: CodeActionProvider
125125
codeActionProvider plId docId _ context = do

src/Haskell/Ide/Engine/Transport/LspStdio.hs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -810,6 +810,7 @@ getFormattingProvider :: R FormattingProvider
810810
getFormattingProvider = do
811811
plugins <- asks idePlugins
812812
config <- getClientConfig
813+
let
813814
-- LL: Is this overengineered? Do we need a pluginFormattingProvider
814815
-- or should we just call plugins straight from here based on the providerType?
815816
providerName = formattingProvider config

0 commit comments

Comments
 (0)