You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
add support multiple watchers per server.
modified the setupFileWatcher method to properly handle asynchronous operations and prevent unhandled promise rejections.
error handling now includes specific error messages that identify exactly where the error occurred.
// we use chokidar instead of onDidSaveTextDocument because it doesn't require the file to be open in the editor. The settings config is better suited for onDidSave since that will be manually updated by the user or Cline (and we want to detect save events, not every file change)
706
-
constwatcher=chokidar.watch(filePath,{
718
+
console.log(`Setting up build/index.js watcher for ${name} MCP server...`)
719
+
// we use chokidar instead of onDidSaveTextDocument because it doesn't require the file to be open in the editor
720
+
constindexJsWatcher=chokidar.watch(filePath,{
707
721
// persistent: true,
708
722
// ignoreInitial: true,
709
723
// awaitWriteFinish: true, // This helps with atomic writes
710
724
})
711
725
712
-
watcher.on("change",()=>{
726
+
indexJsWatcher.on("change",async()=>{
713
727
console.log(`Detected change in ${filePath}. Restarting server ${name}...`)
714
-
this.restartConnection(name)
728
+
try{
729
+
awaitthis.restartConnection(name)
730
+
}catch(error){
731
+
console.error(`Failed to restart server ${name} after change in ${filePath}:`,error)
732
+
}
715
733
})
716
734
717
-
this.fileWatchers.set(name,watcher)
735
+
watchers.push(indexJsWatcher)
736
+
}
737
+
738
+
// Update the fileWatchers map with all watchers for this server
0 commit comments