@@ -21,8 +21,6 @@ module Haskell.Ide.Engine.Plugin.GhcMod
2121 , extractMissingSignature
2222 , extractRenamableTerms
2323 , extractUnusedTerm
24- , infoCmd'
25- -- , lintCmd'
2624 , newTypeCmd
2725 , symbolProvider
2826 ) where
@@ -37,10 +35,7 @@ import Data.Monoid ((<>))
3735import qualified Data.Text as T
3836import Name
3937import GHC.Generics
40- -- import qualified GhcMod as GM ( lint, info )
41- import qualified GhcMod as GM ( info )
42- -- import qualified GhcModCore as GM ( defaultLintOpts, Expression(..), pretty, defaultLintOpts, Expression(..), GhcPs )
43- import qualified GhcModCore as GM ( Expression (.. ), pretty , Expression (.. ), GhcPs )
38+ import qualified GhcModCore as GM ( pretty , GhcPs )
4439import Haskell.Ide.Engine.Ghc
4540import Haskell.Ide.Engine.MonadTypes hiding (defaultOptions )
4641import Haskell.Ide.Engine.PluginUtils
@@ -66,10 +61,14 @@ ghcmodDescriptor plId = PluginDescriptor
6661 <> " in editors. It strives to offer most of the features one has come to expect "
6762 <> " from modern IDEs in any editor."
6863 , pluginCommands =
69- [ PluginCommand " check" " check a file for GHC warnings and errors" checkCmd
70- -- , PluginCommand "lint" "Check files using `hlint'" lintCmd
71- , PluginCommand " info" " Look up an identifier in the context of FILE (like ghci's `:info')" infoCmd
64+ [
65+ -- This one is used in the dispatcher tests, and is a wrapper around what we are already using anyway
66+ PluginCommand " check" " check a file for GHC warnings and errors" checkCmd
67+
68+ -- PluginCommand "info" "Look up an identifier in the context of FILE (like ghci's `:info')" infoCmd
7269 , PluginCommand " type" " Get the type of the expression under (LINE,COL)" typeCmd
70+
71+ -- This one is registered in the vscode plugin, for some reason
7372 , PluginCommand " casesplit" " Generate a pattern match for a binding under (LINE,COL)" Hie. splitCaseCmd
7473 ]
7574 , pluginCodeActionProvider = Just codeActionProvider
@@ -86,17 +85,6 @@ checkCmd = CmdSync setTypecheckedModule
8685
8786-- ---------------------------------------------------------------------
8887
89- -- lintCmd :: CommandFunc Uri T.Text
90- -- lintCmd = CmdSync lintCmd'
91-
92- -- -- TODO:AZ why are we not calling hlint directly?
93- -- lintCmd' :: Uri -> IdeGhcM (IdeResult T.Text)
94- -- lintCmd' uri =
95- -- pluginGetFile "lint: " uri $ \file ->
96- -- fmap T.pack <$> Hie.runGhcModCommand (GM.lint GM.defaultLintOpts file)
97-
98- -- ---------------------------------------------------------------------
99-
10088customOptions :: Options
10189customOptions = defaultOptions { fieldLabelModifier = camelTo2 ' _' . drop 2 }
10290
@@ -110,14 +98,14 @@ instance FromJSON InfoParams where
11098instance ToJSON InfoParams where
11199 toJSON = genericToJSON customOptions
112100
113- infoCmd :: CommandFunc InfoParams T. Text
114- infoCmd = CmdSync $ \ (IP uri expr) ->
115- infoCmd' uri expr
101+ -- infoCmd :: CommandFunc InfoParams T.Text
102+ -- infoCmd = CmdSync $ \(IP uri expr) ->
103+ -- infoCmd' uri expr
116104
117- infoCmd' :: Uri -> T. Text -> IdeGhcM (IdeResult T. Text )
118- infoCmd' uri expr =
119- pluginGetFile " info: " uri $ \ file ->
120- fmap T. pack <$> Hie. runGhcModCommand (GM. info file (GM. Expression (T. unpack expr)))
105+ -- infoCmd' :: Uri -> T.Text -> IdeGhcM (IdeResult T.Text)
106+ -- infoCmd' uri expr =
107+ -- pluginGetFile "info: " uri $ \file ->
108+ -- fmap T.pack <$> Hie.runGhcModCommand (GM.info file (GM.Expression (T.unpack expr)))
121109
122110-- ---------------------------------------------------------------------
123111data TypeParams =
@@ -135,6 +123,7 @@ typeCmd :: CommandFunc TypeParams [(Range,T.Text)]
135123typeCmd = CmdSync $ \ (TP _bool uri pos) ->
136124 liftToGhc $ newTypeCmd pos uri
137125
126+ -- AZ: currently only used in tests, but
138127newTypeCmd :: Position -> Uri -> IdeM (IdeResult [(Range , T. Text )])
139128newTypeCmd newPos uri =
140129 pluginGetFile " newTypeCmd: " uri $ \ fp ->
0 commit comments