File tree Expand file tree Collapse file tree 4 files changed +31
-4
lines changed
lsp-test/src/Language/LSP
src/Language/LSP/Protocol Expand file tree Collapse file tree 4 files changed +31
-4
lines changed Original file line number Diff line number Diff line change @@ -418,7 +418,7 @@ createDoc file languageId contents = do
418
418
watchHits :: FileSystemWatcher -> Bool
419
419
watchHits (FileSystemWatcher (GlobPattern (InL (Pattern pattern ))) kind) =
420
420
-- If WatchKind is excluded, defaults to all true as per spec
421
- fileMatches (T. unpack pattern ) && createHits (fromMaybe WatchKind_Create kind)
421
+ fileMatches (T. unpack pattern ) && containsCreate (fromMaybe WatchKind_Create kind)
422
422
-- TODO: Relative patterns
423
423
watchHits _ = False
424
424
@@ -428,9 +428,6 @@ createDoc file languageId contents = do
428
428
| isAbsolute pattern = absFile
429
429
| otherwise = file
430
430
431
- createHits WatchKind_Create = True
432
- createHits _ = False
433
-
434
431
regHits :: TRegistration Method_WorkspaceDidChangeWatchedFiles -> Bool
435
432
regHits reg = foldl' (\ acc w -> acc || watchHits w) False (reg ^. L. registerOptions . _Just . L. watchers)
436
433
Original file line number Diff line number Diff line change @@ -126,6 +126,7 @@ library
126
126
Language.LSP.Protocol.Types.Singletons
127
127
Language.LSP.Protocol.Types.Uri
128
128
Language.LSP.Protocol.Types.Uri.OsPath
129
+ Language.LSP.Protocol.Types.WatchKinds
129
130
130
131
-- The generated modules
131
132
-- In principle these could be in a separate component,
Original file line number Diff line number Diff line change @@ -20,6 +20,8 @@ module Language.LSP.Protocol.Types (
20
20
, module Progress
21
21
-- ** Semantic tokens
22
22
, module SemanticTokens
23
+ -- ** WatchKinds
24
+ , module WatchKinds
23
25
-- * Main LSP types and functions
24
26
, module Generated
25
27
) where
@@ -35,3 +37,4 @@ import Language.LSP.Protocol.Types.Singletons as Singletons
35
37
import Language.LSP.Protocol.Types.Uri as Uri
36
38
import Language.LSP.Protocol.Types.Uri.OsPath as Uri
37
39
import Language.LSP.Protocol.Types.Edit as Edits
40
+ import Language.LSP.Protocol.Types.WatchKinds as WatchKinds
Original file line number Diff line number Diff line change
1
+ module Language.LSP.Protocol.Types.WatchKinds where
2
+
3
+ import Language.LSP.Protocol.Internal.Types (WatchKind (.. ))
4
+ import Language.LSP.Protocol.Types.LspEnum (toEnumBaseType , fromOpenEnumBaseType )
5
+ import Data.Set (toList , Set )
6
+
7
+ containsCreate :: WatchKind -> Bool
8
+ containsCreate WatchKind_Create = True
9
+ containsCreate (WatchKind_Custom 3 ) = True
10
+ containsCreate (WatchKind_Custom 5 ) = True
11
+ containsCreate _ = False
12
+
13
+ containsChange :: WatchKind -> Bool
14
+ containsChange WatchKind_Change = True
15
+ containsChange (WatchKind_Custom 3 ) = True
16
+ containsChange (WatchKind_Custom 6 ) = True
17
+ containsChange _ = False
18
+
19
+ containsDelete :: WatchKind -> Bool
20
+ containsDelete WatchKind_Delete = True
21
+ containsDelete (WatchKind_Custom 5 ) = True
22
+ containsDelete (WatchKind_Custom 6 ) = True
23
+ containsDelete _ = False
24
+
25
+ combineWatchKinds :: Set WatchKind -> WatchKind
26
+ combineWatchKinds s = fromOpenEnumBaseType $ sum $ toEnumBaseType <$> toList s
You can’t perform that action at this time.
0 commit comments