How to know which file the user is editing?

Basically I want to know how you can know which file the user is editing? I’m guessing it has something to do with File Handlers but the docs aren’t very helpful on how to use them

1 Like

Yeah I don’t think there is documented API for that.

2 Likes

You can use the fs module to watch every file using fs.watchFile() to listen for any changes to the file, which you can find the file that is being edited based on the file activity.

And until recently, you could also use the layout module and using layout.findPaneByType() to find any file tabs, though it has since been deprecated.

In the future, the new rui module could be used to find the file that is being edited by the user more easily.

3 Likes

As far as I know, rui is going to be used to expose Replit’s UI library.

I’m not too sure, @ArnavBansal if you could explain further please :slight_smile:

2 Likes