When I have a collection of multiple scripts in a Replit project, I would like to run the script I have currently open in the Replit editor. So something like you can do in VS Code where you can specify the launch task for the current file.
I know that I can always manually edit the
.replit file and enter the desired path as
entrypoint, but some configuration to automatically run the currently open file would be cool.
I don’t think this exists and I think it would be a good feature request.
Welcome to the community! @sonicx180
I’ve moved this topic to #feature-requests as this doesn’t seem to be a feature yet.
Add/change in the start of the
.replit file (replace
*.py with the glob of the files you want to run):
onBoot = 'for i in *.py; do ((/nix/store/fbi9r30p3lqk96lmw5b1v1bpbj62cr2l-inotify-tools-220.127.116.11/bin/inotifywait -e modify $i;sed -i "/entrypoint/s/\".*\"/\"$i\"/" .replit)&);done'
improved: add/change to start of
onBoot = '''/nix/store/fbi9r30p3lqk96lmw5b1v1bpbj62cr2l-inotify-tools-18.104.22.168/bin/inotifywait -rqme create --format=%f%w --include='\..+\.py.[0-9]+~' .|while
read -r l||[ "$l" ]
done<.replit||echo -n "$o">.replit
kill 1 in Shell.
This will map the entrypoint to the last file you edited through the IDE.
.+\.py on line 1 with the ERE of the files you want to be auto-set as entrypoint.
(I tried an option which checks for you just visiting the file in the editor but I found that that’s impossible. Maybe you can do this with an extension)
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.