MCPcopy Index your code
hub / github.com/microsoft/typescript-go / UnwatchFiles

Method UnwatchFiles

internal/lsp/server.go:259–288  ·  view source on GitHub ↗

UnwatchFiles implements project.Client.

(ctx context.Context, id project.WatcherID)

Source from the content-addressed store, hash-verified

257
258// UnwatchFiles implements project.Client.
259func (s *Server) UnwatchFiles(ctx context.Context, id project.WatcherID) error {
260 if s.builtinWatcher != nil {
261 if !s.watchers.Has(id) {
262 return fmt.Errorf("no file watcher exists with ID %s", id)
263 }
264 if err := s.builtinWatcher.UnwatchFiles(string(id)); err != nil {
265 return fmt.Errorf("failed to unregister file watcher: %w", err)
266 }
267 s.watchers.Delete(id)
268 return nil
269 }
270 if s.watchers.Has(id) {
271 _, err := sendClientRequest(ctx, s, lsproto.ClientUnregisterCapabilityInfo, &lsproto.UnregistrationParams{
272 Unregisterations: []*lsproto.Unregistration{
273 {
274 Id: string(id),
275 Method: string(lsproto.MethodWorkspaceDidChangeWatchedFiles),
276 },
277 },
278 })
279 if err != nil {
280 return fmt.Errorf("failed to unregister file watcher: %w", err)
281 }
282
283 s.watchers.Delete(id)
284 return nil
285 }
286
287 return fmt.Errorf("no file watcher exists with ID %s", id)
288}
289
290// RefreshDiagnostics implements project.Client.
291func (s *Server) RefreshDiagnostics(ctx context.Context) error {

Callers

nothing calls this directly

Calls 6

sendClientRequestFunction · 0.85
ErrorfMethod · 0.65
UnwatchFilesMethod · 0.65
DeleteMethod · 0.65
stringEnum · 0.50
HasMethod · 0.45

Tested by

no test coverage detected