UnwatchFiles implements project.Client.
(ctx context.Context, id project.WatcherID)
| 257 | |
| 258 | // UnwatchFiles implements project.Client. |
| 259 | func (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. |
| 291 | func (s *Server) RefreshDiagnostics(ctx context.Context) error { |
nothing calls this directly
no test coverage detected