@@ -46,8 +46,8 @@ import Distribution.PackageDescription.Configuration (flattenPackageDe
46
46
import Distribution.Parsec.Error
47
47
import qualified Distribution.Parsec.Position as Syntax
48
48
import GHC.Generics
49
+ import Ide.Plugin.Cabal.Orphans ()
49
50
import Ide.Plugin.CabalProject.Diagnostics as Diagnostics
50
- import Ide.Plugin.CabalProject.Orphans ()
51
51
import Ide.Plugin.CabalProject.Parse as Parse
52
52
import Ide.Plugin.CabalProject.Types as Types
53
53
import Ide.Plugin.Error
@@ -58,7 +58,6 @@ import Language.LSP.Protocol.Types
58
58
import qualified Language.LSP.VFS as VFS
59
59
import System.FilePath (takeFileName )
60
60
import Text.Regex.TDFA
61
- -- import Ide.Plugin.Cabal.Orphans ()
62
61
63
62
data Log
64
63
= LogModificationTime NormalizedFilePath FileVersion
@@ -99,14 +98,12 @@ descriptor recorder plId =
99
98
\ ide vfs _ (DidOpenTextDocumentParams TextDocumentItem {_uri, _version}) -> liftIO $ do
100
99
whenUriFile _uri $ \ file -> do
101
100
log' Debug $ LogDocOpened _uri
102
- -- parseAndPrint (fromNormalizedFilePath file)
103
101
restartCabalShakeSession (shakeExtras ide) vfs file " (opened)" $
104
102
addFileOfInterest recorder ide file Modified {firstOpen = True }
105
103
, mkPluginNotificationHandler LSP. SMethod_TextDocumentDidChange $
106
104
\ ide vfs _ (DidChangeTextDocumentParams VersionedTextDocumentIdentifier {_uri} _) -> liftIO $ do
107
105
whenUriFile _uri $ \ file-> do
108
106
log' Debug $ LogDocModified _uri
109
- -- parseAndPrint (fromNormalizedFilePath file)
110
107
restartCabalShakeSession (shakeExtras ide) vfs file " (changed)" $
111
108
addFileOfInterest recorder ide file Modified {firstOpen = False }
112
109
, mkPluginNotificationHandler LSP. SMethod_TextDocumentDidSave $
@@ -132,28 +129,6 @@ descriptor recorder plId =
132
129
whenUriFile :: Uri -> (NormalizedFilePath -> IO () ) -> IO ()
133
130
whenUriFile uri act = whenJust (uriToFilePath uri) $ act . toNormalizedFilePath'
134
131
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
-
157
132
{- | Helper function to restart the shake session, specifically for modifying .cabal files.
158
133
No special logic, just group up a bunch of functions you need for the base
159
134
Notification Handlers.
0 commit comments