@@ -46,8 +46,8 @@ import Distribution.PackageDescription.Configuration (flattenPackageDe
4646import Distribution.Parsec.Error
4747import qualified Distribution.Parsec.Position as Syntax
4848import GHC.Generics
49+ import Ide.Plugin.Cabal.Orphans ()
4950import Ide.Plugin.CabalProject.Diagnostics as Diagnostics
50- import Ide.Plugin.CabalProject.Orphans ()
5151import Ide.Plugin.CabalProject.Parse as Parse
5252import Ide.Plugin.CabalProject.Types as Types
5353import Ide.Plugin.Error
@@ -58,7 +58,6 @@ import Language.LSP.Protocol.Types
5858import qualified Language.LSP.VFS as VFS
5959import System.FilePath (takeFileName )
6060import Text.Regex.TDFA
61- -- import Ide.Plugin.Cabal.Orphans ()
6261
6362data 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.
158133No special logic, just group up a bunch of functions you need for the base
159134Notification Handlers.
0 commit comments