Skip to content

Commit 8dc4a54

Browse files
committed
finish cleaning up diagnostics code
1 parent c05125e commit 8dc4a54

File tree

3 files changed

+1
-255
lines changed

3 files changed

+1
-255
lines changed

haskell-language-server.cabal

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,6 @@ library hls-cabal-project-plugin
340340
Ide.Plugin.CabalProject.Parse
341341
Ide.Plugin.CabalProject.Diagnostics
342342
Ide.Plugin.CabalProject.Types
343-
Ide.Plugin.CabalProject.Orphans
344343

345344
build-depends:
346345
, bytestring

plugins/hls-cabal-project-plugin/src/Ide/Plugin/CabalProject.hs

Lines changed: 1 addition & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,8 @@ import Distribution.PackageDescription.Configuration (flattenPackageDe
4646
import Distribution.Parsec.Error
4747
import qualified Distribution.Parsec.Position as Syntax
4848
import GHC.Generics
49+
import Ide.Plugin.Cabal.Orphans ()
4950
import Ide.Plugin.CabalProject.Diagnostics as Diagnostics
50-
import Ide.Plugin.CabalProject.Orphans ()
5151
import Ide.Plugin.CabalProject.Parse as Parse
5252
import Ide.Plugin.CabalProject.Types as Types
5353
import Ide.Plugin.Error
@@ -58,7 +58,6 @@ import Language.LSP.Protocol.Types
5858
import qualified Language.LSP.VFS as VFS
5959
import System.FilePath (takeFileName)
6060
import Text.Regex.TDFA
61-
-- import Ide.Plugin.Cabal.Orphans ()
6261

6362
data Log
6463
= LogModificationTime NormalizedFilePath FileVersion
@@ -99,14 +98,12 @@ descriptor recorder plId =
9998
\ide vfs _ (DidOpenTextDocumentParams TextDocumentItem{_uri, _version}) -> liftIO $ do
10099
whenUriFile _uri $ \file -> do
101100
log' Debug $ LogDocOpened _uri
102-
-- parseAndPrint (fromNormalizedFilePath file)
103101
restartCabalShakeSession (shakeExtras ide) vfs file "(opened)" $
104102
addFileOfInterest recorder ide file Modified{firstOpen = True}
105103
, mkPluginNotificationHandler LSP.SMethod_TextDocumentDidChange $
106104
\ide vfs _ (DidChangeTextDocumentParams VersionedTextDocumentIdentifier{_uri} _) -> liftIO $ do
107105
whenUriFile _uri $ \file-> do
108106
log' Debug $ LogDocModified _uri
109-
-- parseAndPrint (fromNormalizedFilePath file)
110107
restartCabalShakeSession (shakeExtras ide) vfs file "(changed)" $
111108
addFileOfInterest recorder ide file Modified{firstOpen = False}
112109
, mkPluginNotificationHandler LSP.SMethod_TextDocumentDidSave $
@@ -132,28 +129,6 @@ descriptor recorder plId =
132129
whenUriFile :: Uri -> (NormalizedFilePath -> IO ()) -> IO ()
133130
whenUriFile uri act = whenJust (uriToFilePath uri) $ act . toNormalizedFilePath'
134131

135-
-- for development/debugging
136-
parseAndPrint :: FilePath -> IO ()
137-
parseAndPrint file = do
138-
bytes <- BS.readFile file
139-
(warnings, res) <- Parse.parseCabalProjectFileContents file bytes
140-
141-
mapM_ (putStrLn . ("[Cabal warning] " ++) . show) warnings
142-
143-
case res of
144-
Left (_mbSpecVer, errs) ->
145-
putStrLn $
146-
"Cabal project parse failed:\n" ++ unlines (map show (NE.toList errs))
147-
148-
Right project ->
149-
putStrLn $
150-
"Cabal project parsed successfully:\n" ++ show project
151-
152-
bs <- BS.readFile file
153-
case Parse.readCabalProjectFields (toNormalizedFilePath' file) bs of
154-
Left diag -> putStrLn $ "readCabalProjectFields error:\n" ++ show diag
155-
Right flds -> putStrLn $ "readCabalProjectFields success:\n" ++ show flds
156-
157132
{- | Helper function to restart the shake session, specifically for modifying .cabal files.
158133
No special logic, just group up a bunch of functions you need for the base
159134
Notification Handlers.

plugins/hls-cabal-project-plugin/src/Ide/Plugin/CabalProject/Orphans.hs

Lines changed: 0 additions & 228 deletions
This file was deleted.

0 commit comments

Comments
 (0)