@@ -10,7 +10,6 @@ import (
10
10
"github.com/microsoft/typescript-go/internal/ast"
11
11
"github.com/microsoft/typescript-go/internal/collections"
12
12
"github.com/microsoft/typescript-go/internal/core"
13
- "github.com/microsoft/typescript-go/internal/glob"
14
13
"github.com/microsoft/typescript-go/internal/lsp/lsproto"
15
14
"github.com/microsoft/typescript-go/internal/module"
16
15
"github.com/microsoft/typescript-go/internal/tspath"
@@ -55,13 +54,11 @@ type WatchedFiles[T any] struct {
55
54
watchKind lsproto.WatchKind
56
55
computeGlobPatterns func (input T ) patternsAndIgnored
57
56
58
- input T
59
- computeWatchersOnce sync.Once
60
- watchers []* lsproto.FileSystemWatcher
61
- ignored map [string ]struct {}
62
- computeParsedGlobsOnce sync.Once
63
- parsedGlobs []* glob.Glob
64
- id uint64
57
+ input T
58
+ computeWatchersOnce sync.Once
59
+ watchers []* lsproto.FileSystemWatcher
60
+ ignored map [string ]struct {}
61
+ id uint64
65
62
}
66
63
67
64
func NewWatchedFiles [T any ](name string , watchKind lsproto.WatchKind , computeGlobPatterns func (input T ) patternsAndIgnored ) * WatchedFiles [T ] {
@@ -113,29 +110,13 @@ func (w *WatchedFiles[T]) WatchKind() lsproto.WatchKind {
113
110
return w .watchKind
114
111
}
115
112
116
- func (w * WatchedFiles [T ]) ParsedGlobs () []* glob.Glob {
117
- w .computeParsedGlobsOnce .Do (func () {
118
- _ , watchers := w .Watchers ()
119
- w .parsedGlobs = make ([]* glob.Glob , 0 , len (watchers ))
120
- for _ , watcher := range watchers {
121
- if g , err := glob .Parse (* watcher .GlobPattern .Pattern ); err == nil {
122
- w .parsedGlobs = append (w .parsedGlobs , g )
123
- } else {
124
- panic ("failed to parse glob pattern: " + * watcher .GlobPattern .Pattern )
125
- }
126
- }
127
- })
128
- return w .parsedGlobs
129
- }
130
-
131
113
func (w * WatchedFiles [T ]) Clone (input T ) * WatchedFiles [T ] {
132
114
return & WatchedFiles [T ]{
133
115
name : w .name ,
134
116
watchKind : w .watchKind ,
135
117
computeGlobPatterns : w .computeGlobPatterns ,
136
118
watchers : w .watchers ,
137
119
input : input ,
138
- parsedGlobs : w .parsedGlobs ,
139
120
}
140
121
}
141
122
0 commit comments