File tree Expand file tree Collapse file tree 1 file changed +19
-0
lines changed
Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -103,6 +103,25 @@ export async function activate(context: vscode.ExtensionContext) {
103103 const apps = await discoverFastAPIApps ( parserService )
104104 const endpointProvider = new EndpointTreeProvider ( apps )
105105
106+ let refreshTimeout : NodeJS . Timeout | null = null
107+
108+ const triggerRefresh = ( ) => {
109+ if ( refreshTimeout ) {
110+ clearTimeout ( refreshTimeout )
111+ }
112+ refreshTimeout = setTimeout ( async ( ) => {
113+ const newApps = await discoverFastAPIApps ( parserService )
114+ endpointProvider . setApps ( newApps )
115+ } , 500 ) // Debounce for 500ms
116+ }
117+
118+ // Watch for changes in Python files to refresh endpoints
119+ const watcher = vscode . workspace . createFileSystemWatcher ( "**/*.py" )
120+ watcher . onDidChange ( triggerRefresh )
121+ watcher . onDidCreate ( triggerRefresh )
122+ watcher . onDidDelete ( triggerRefresh )
123+ context . subscriptions . push ( watcher )
124+
106125 const treeView = vscode . window . createTreeView ( "endpoint-explorer" , {
107126 treeDataProvider : endpointProvider ,
108127 } )
You can’t perform that action at this time.
0 commit comments