@@ -81,12 +81,10 @@ applyOneCmd = CmdSync $ \(AOP uri pos title) -> do
81
81
applyOneCmd' :: Uri -> OneHint -> IdeGhcM (IdeResult WorkspaceEdit )
82
82
applyOneCmd' uri oneHint = pluginGetFile " applyOne: " uri $ \ fp -> do
83
83
revMapp <- reverseFileMap
84
- let resultFail = return $ IdeResultFail
85
- (IdeError PluginError
86
- (T. pack " applyOne: no access to the persisted file." )
87
- Null
88
- )
89
- withMappedFile fp resultFail $ \ file' -> do
84
+ let defaultResult = do
85
+ debugm " applyOne: no access to the persisted file."
86
+ return $ IdeResultOk mempty
87
+ withMappedFile fp defaultResult $ \ file' -> do
90
88
res <- liftToGhc $ applyHint file' (Just oneHint) revMapp
91
89
logm $ " applyOneCmd:file=" ++ show fp
92
90
logm $ " applyOneCmd:res=" ++ show res
@@ -104,13 +102,11 @@ applyAllCmd = CmdSync $ \uri -> do
104
102
105
103
applyAllCmd' :: Uri -> IdeGhcM (IdeResult WorkspaceEdit )
106
104
applyAllCmd' uri = pluginGetFile " applyAll: " uri $ \ fp -> do
107
- let resultFail = return $ IdeResultFail
108
- (IdeError PluginError
109
- (T. pack " applyAll: no access to the persisted file." )
110
- Null
111
- )
105
+ let defaultResult = do
106
+ debugm " applyAll: no access to the persisted file."
107
+ return $ IdeResultOk mempty
112
108
revMapp <- reverseFileMap
113
- withMappedFile fp resultFail $ \ file' -> do
109
+ withMappedFile fp defaultResult $ \ file' -> do
114
110
res <- liftToGhc $ applyHint file' Nothing revMapp
115
111
logm $ " applyAllCmd:res=" ++ show res
116
112
case res of
@@ -127,12 +123,12 @@ lintCmd = CmdSync $ \uri -> do
127
123
-- AZ:TODO: Why is this in IdeGhcM?
128
124
lintCmd' :: Uri -> IdeGhcM (IdeResult PublishDiagnosticsParams )
129
125
lintCmd' uri = pluginGetFile " lintCmd: " uri $ \ fp -> do
130
- let resultFail = return $ IdeResultFail
131
- ( IdeError PluginError
132
- ( T. pack " lintCmd: no access to the persisted file." )
133
- Null
134
- )
135
- withMappedFile fp resultFail $ \ file' -> do
126
+ let
127
+ defaultResult = do
128
+ debugm " lintCmd: not access to the persisted file."
129
+ return
130
+ $ IdeResultOk ( PublishDiagnosticsParams (filePathToUri fp) $ List [] )
131
+ withMappedFile fp defaultResult $ \ file' -> do
136
132
eitherErrorResult <- liftIO
137
133
(try $ runExceptT $ runLintCmd file' [] :: IO
138
134
(Either IOException (Either [Diagnostic ] [Idea ]))
0 commit comments