File tree 2 files changed +16
-2
lines changed
ghcide/src/Development/IDE 2 files changed +16
-2
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 ,
@@ -57,6 +58,11 @@ ofInterestRules = do
57
58
------------------------------------------------------------
58
59
-- Exposed API
59
60
61
+ getFilesOfInterest :: IdeState -> IO ( HashMap NormalizedFilePath FileOfInterestStatus )
62
+ getFilesOfInterest state = do
63
+ OfInterestVar var <- getIdeGlobalState state
64
+ readVar var
65
+
60
66
-- | Set the files-of-interest - not usually necessary or advisable.
61
67
-- The LSP client will keep this information up to date.
62
68
setFilesOfInterest :: IdeState -> HashMap NormalizedFilePath FileOfInterestStatus -> IO ()
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