@@ -14,9 +14,8 @@ import Development.IDE (GetParsedModule (GetParsedModu
14
14
GhcSession (GhcSession ),
15
15
IdeState , RuleResult , Rules ,
16
16
define , getFileContents ,
17
- hscEnv , ideLogger ,
18
- realSrcSpanToRange , runAction ,
19
- use , useWithStale )
17
+ hscEnv , realSrcSpanToRange ,
18
+ runAction , use , useWithStale )
20
19
import qualified Development.IDE.Core.Shake as Shake
21
20
import Development.IDE.GHC.Compat hiding (getSrcSpan )
22
21
import Development.IDE.GHC.Compat.Util (toList )
@@ -31,8 +30,8 @@ import Ide.Plugin.Conversion (AlternateFormat,
31
30
ExtensionNeeded (NeedsExtension , NoExtension ),
32
31
alternateFormat )
33
32
import Ide.Plugin.Literals
34
- import Ide.PluginUtils (handleMaybe , handleMaybeM ,
35
- response )
33
+ import Ide.PluginUtils (getNormalizedFilePath ,
34
+ handleMaybeM , response )
36
35
import Ide.Types
37
36
import Language.LSP.Types
38
37
import Language.LSP.Types.Lens (uri )
@@ -84,8 +83,8 @@ collectLiteralsRule recorder = define (cmapWithPrio LogShake recorder) $ \Collec
84
83
getExtensions = map GhcExtension . toList . extensionFlags . ms_hspp_opts . pm_mod_summary
85
84
86
85
codeActionHandler :: PluginMethodHandler IdeState 'TextDocumentCodeAction
87
- codeActionHandler state _ (CodeActionParams _ _ docId currRange _) = response $ do
88
- nfp <- getNormalizedFilePath docId
86
+ codeActionHandler state plId (CodeActionParams _ _ docId currRange _) = response $ do
87
+ nfp <- getNormalizedFilePath plId ( docId ^. uri)
89
88
CLR {.. } <- requestLiterals state nfp
90
89
pragma <- getFirstPragma state nfp
91
90
-- remove any invalid literals (see validTarget comment)
@@ -151,12 +150,6 @@ getFirstPragma state nfp = handleMaybeM "Error: Could not get NextPragmaInfo" $
151
150
Just (hscEnv -> hsc_dflags -> sessionDynFlags, _) -> pure $ Just $ getNextPragmaInfo sessionDynFlags fileContents
152
151
Nothing -> pure Nothing
153
152
154
-
155
- getNormalizedFilePath :: Monad m => TextDocumentIdentifier -> ExceptT String m NormalizedFilePath
156
- getNormalizedFilePath docId = handleMaybe " Error: converting to NormalizedFilePath"
157
- $ uriToNormalizedFilePath
158
- $ toNormalizedUri (docId ^. uri)
159
-
160
153
requestLiterals :: MonadIO m => IdeState -> NormalizedFilePath -> ExceptT String m CollectLiteralsResult
161
154
requestLiterals state = handleMaybeM " Error: Could not Collect Literals"
162
155
. liftIO
0 commit comments