@@ -136,7 +136,7 @@ class LinkWatcher extends Disposable {
136
136
*/
137
137
public readonly onDidChangeLinkedToFile = this . _onDidChangeLinkedToFile . event ;
138
138
139
- private readonly _watchers = new Map < /* link path */ string , {
139
+ private readonly _watchers = new ResourceMap < {
140
140
/**
141
141
* Watcher for this link path
142
142
*/
@@ -145,7 +145,7 @@ class LinkWatcher extends Disposable {
145
145
/**
146
146
* List of documents that reference the link
147
147
*/
148
- readonly documents : Map < /* document resource as string */ string , /* document resource*/ vscode . Uri > ;
148
+ readonly documents : ResourceMap < /* document resource*/ vscode . Uri > ;
149
149
} > ( ) ;
150
150
151
151
override dispose ( ) {
@@ -168,21 +168,21 @@ class LinkWatcher extends Disposable {
168
168
169
169
// First decrement watcher counter for previous document state
170
170
for ( const entry of this . _watchers . values ( ) ) {
171
- entry . documents . delete ( document . toString ( ) ) ;
171
+ entry . documents . delete ( document ) ;
172
172
}
173
173
174
174
// Then create/update watchers for new document state
175
175
for ( const path of linkedToResource ) {
176
- let entry = this . _watchers . get ( path . toString ( ) ) ;
176
+ let entry = this . _watchers . get ( path ) ;
177
177
if ( ! entry ) {
178
178
entry = {
179
179
watcher : this . startWatching ( path ) ,
180
- documents : new Map ( ) ,
180
+ documents : new ResourceMap ( ) ,
181
181
} ;
182
- this . _watchers . set ( path . toString ( ) , entry ) ;
182
+ this . _watchers . set ( path , entry ) ;
183
183
}
184
184
185
- entry . documents . set ( document . toString ( ) , document ) ;
185
+ entry . documents . set ( document , document ) ;
186
186
}
187
187
188
188
// Finally clean up watchers for links that are no longer are referenced anywhere
@@ -209,7 +209,7 @@ class LinkWatcher extends Disposable {
209
209
}
210
210
211
211
private onLinkedResourceChanged ( resource : vscode . Uri ) {
212
- const entry = this . _watchers . get ( resource . toString ( ) ) ;
212
+ const entry = this . _watchers . get ( resource ) ;
213
213
if ( entry ) {
214
214
this . _onDidChangeLinkedToFile . fire ( entry . documents . values ( ) ) ;
215
215
}
0 commit comments