File tree 2 files changed +17
-3
lines changed
ghcide/src/Development/IDE
2 files changed +17
-3
lines changed Original file line number Diff line number Diff line change 8
8
-- open in the editor. The rule is 'IsFileOfInterest'
9
9
module Development.IDE.Core.OfInterest (
10
10
ofInterestRules ,
11
+ getFilesOfInterest ,
11
12
getFilesOfInterestUntracked ,
12
13
addFileOfInterest ,
13
14
deleteFileOfInterest ,
@@ -58,6 +59,11 @@ ofInterestRules = do
58
59
------------------------------------------------------------
59
60
-- Exposed API
60
61
62
+ getFilesOfInterest :: IdeState -> IO ( HashMap NormalizedFilePath FileOfInterestStatus )
63
+ getFilesOfInterest state = do
64
+ OfInterestVar var <- getIdeGlobalState state
65
+ readVar var
66
+
61
67
-- | Set the files-of-interest - not usually necessary or advisable.
62
68
-- The LSP client will keep this information up to date.
63
69
setFilesOfInterest :: IdeState -> HashMap NormalizedFilePath FileOfInterestStatus -> IO ()
@@ -107,4 +113,4 @@ kick = do
107
113
108
114
-- if idle, perform garbage collection
109
115
liftIO $ sleep 5
110
- garbageCollectDirtyKeys
116
+ -- garbageCollectDirtyKeys
Original file line number Diff line number Diff line change @@ -26,6 +26,7 @@ import qualified Data.HashSet as S
26
26
import qualified Data.Text as Text
27
27
28
28
import Control.Monad.IO.Class
29
+ import qualified Data.HashMap.Strict as HM
29
30
import Development.IDE.Core.FileExists (modifyFileExists ,
30
31
watchedGlobs )
31
32
import Development.IDE.Core.FileStore (registerFileWatches ,
@@ -84,8 +85,15 @@ descriptor plId = (defaultPluginDescriptor plId) { pluginNotificationHandlers =
84
85
-- what we do with them
85
86
let msg = show fileEvents
86
87
logDebug (ideLogger ide) $ " Watched file events: " <> Text. pack msg
87
- modifyFileExists ide fileEvents
88
- resetFileStore ide fileEvents
88
+ -- filter out files of interest, since we already know all about those
89
+ filesOfInterest <- getFilesOfInterest ide
90
+ let fileEvents' =
91
+ [ f | f@ (FileEvent uri _) <- fileEvents
92
+ , Just fp <- [uriToFilePath uri]
93
+ , not $ HM. member (toNormalizedFilePath fp) filesOfInterest
94
+ ]
95
+ modifyFileExists ide fileEvents'
96
+ resetFileStore ide fileEvents'
89
97
setSomethingModified ide [] msg
90
98
91
99
, mkPluginNotificationHandler LSP. SWorkspaceDidChangeWorkspaceFolders $
You can’t perform that action at this time.
0 commit comments