Skip to content

Commit 4d499cc

Browse files
committed
non-formatting plugins
1 parent 8c6b23e commit 4d499cc

File tree

35 files changed

+299
-296
lines changed

35 files changed

+299
-296
lines changed

ghcide/src/Development/IDE/GHC/Warnings.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ withWarnings diagSource action = do
3737
return (reverse $ concat warns, res)
3838

3939
attachReason :: WarnReason -> Diagnostic -> Diagnostic
40-
attachReason wr d = d{_code = InR . T.unpack <$> showReason wr}
40+
attachReason wr d = d{_code = InR <$> showReason wr}
4141
where
4242
showReason = \case
4343
NoReason -> Nothing

ghcide/src/Development/IDE/Plugin/CodeAction.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ findDeclContainingLoc loc = find (\(L l _) -> loc `isInsideSrcSpan` l)
175175

176176
suggestDisableWarning :: ParsedModule -> Maybe T.Text -> Diagnostic -> [(T.Text, [TextEdit])]
177177
suggestDisableWarning pm contents Diagnostic{..}
178-
| Just (InR (T.stripPrefix "-W" . T.pack -> Just w)) <- _code =
178+
| Just (InR (T.stripPrefix "-W" -> Just w)) <- _code =
179179
pure
180180
( "Disable \"" <> w <> "\" warnings"
181181
, [TextEdit (endOfModuleHeader pm contents) $ "{-# OPTIONS_GHC -Wno-" <> w <> " #-}\n"]

haskell-language-server.cabal

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ library
6666
, ghc
6767
, ghcide >=0.7
6868
, gitrev
69-
, haskell-lsp ^>=0.23
69+
, lsp
7070
, hls-plugin-api >=0.7
7171
, hie-bios
7272
, hiedb
@@ -323,7 +323,7 @@ executable haskell-language-server
323323
, ghcide
324324
, hashable
325325
, haskell-language-server
326-
, haskell-lsp ^>=0.23
326+
, lsp
327327
, hie-bios
328328
, hiedb
329329
, lens
@@ -386,7 +386,7 @@ common hls-test-utils
386386
, blaze-markup
387387
, containers
388388
, data-default
389-
, haskell-lsp
389+
, lsp
390390
, hie-bios
391391
, hls-plugin-api >=0.6
392392
, hslogger

hls-plugin-api/src/Ide/Plugin/Config.hs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ import GHC.Generics (Generic)
2626

2727
-- | Given a DidChangeConfigurationNotification message, this function returns the parsed
2828
-- Config object if possible.
29-
getConfigFromNotification :: NotificationMessage WorkspaceDidChangeConfiguration -> Either T.Text Config
30-
getConfigFromNotification (NotificationMessage _ _ (DidChangeConfigurationParams p)) =
29+
getConfigFromNotification :: Applicative m => a -> A.Value -> m (Either T.Text Config)
30+
getConfigFromNotification _ p = pure $
3131
case fromJSON p of
3232
A.Success c -> Right c
3333
A.Error err -> Left $ T.pack err

hls-plugin-api/src/Ide/Types.hs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,11 +218,13 @@ instance Semigroup (PluginHandlers a) where
218218
instance Monoid (PluginHandlers a) where
219219
mempty = PluginHandlers mempty
220220

221+
type SimpleHandler a m = a -> PluginId -> MessageParams m -> LspM Config (Either ResponseError (ResponseResult m))
222+
221223
-- | Make a handler for plugins with no extra data
222224
mkPluginHandler
223225
:: PluginMethod m
224226
=> SClientMethod m
225-
-> (ideState -> PluginId -> MessageParams m -> LspM Config (Either ResponseError (ResponseResult m)))
227+
-> SimpleHandler ideState m
226228
-> PluginHandlers ideState
227229
mkPluginHandler m f = PluginHandlers $ DMap.singleton (IdeMethod m) (PluginHandler f')
228230
where

plugins/default/src/Ide/Plugin/Brittany.hs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ import qualified Data.Text as T
1212
import Development.IDE
1313
import Development.IDE.GHC.Compat (topDir, ModSummary(ms_hspp_opts))
1414
import Language.Haskell.Brittany
15-
import Language.Haskell.LSP.Types as J
16-
import qualified Language.Haskell.LSP.Types.Lens as J
15+
import Language.LSP.Types as J
16+
import qualified Language.LSP.Types.Lens as J
1717
import Ide.PluginUtils
1818
import Ide.Types
1919

plugins/default/src/Ide/Plugin/Example.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ import Development.IDE.Core.Shake (getDiagnostics, getHiddenDiagnostics)
2929
import GHC.Generics
3030
import Ide.PluginUtils
3131
import Ide.Types
32-
import Language.Haskell.LSP.Types
32+
import Language.LSP.Types
3333
import Text.Regex.TDFA.Text()
3434

3535
-- ---------------------------------------------------------------------

plugins/default/src/Ide/Plugin/Example2.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ import Development.IDE.Core.Shake
2828
import GHC.Generics
2929
import Ide.PluginUtils
3030
import Ide.Types
31-
import Language.Haskell.LSP.Types
31+
import Language.LSP.Types
3232
import Text.Regex.TDFA.Text()
3333

3434
-- ---------------------------------------------------------------------

plugins/default/src/Ide/Plugin/Floskell.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import Development.IDE as D
1515
import Floskell
1616
import Ide.PluginUtils
1717
import Ide.Types
18-
import Language.Haskell.LSP.Types
18+
import Language.LSP.Types
1919
import Text.Regex.TDFA.Text()
2020

2121
-- ---------------------------------------------------------------------

plugins/default/src/Ide/Plugin/Fourmolu.hs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,11 @@ import GHC (DynFlags, moduleNameString)
2222
import GHC.LanguageExtensions.Type (Extension (Cpp))
2323
import GhcPlugins (HscEnv (hsc_dflags))
2424
import Ide.PluginUtils (responseError, makeDiffTextEdit)
25-
import Language.Haskell.LSP.Messages (FromServerMessage (ReqShowMessage))
2625

2726
import Ide.Types
28-
import Language.Haskell.LSP.Core
29-
import Language.Haskell.LSP.Types
30-
import Language.Haskell.LSP.Types.Lens
27+
import Language.LSP.Server
28+
import Language.LSP.Types
29+
import Language.LSP.Types.Lens
3130
import "fourmolu" Ormolu
3231

3332
-- ---------------------------------------------------------------------

0 commit comments

Comments
 (0)