Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

run tasks without saving file #18764

Open
1 task done
RustoMCSpit opened this issue Oct 5, 2024 · 2 comments
Open
1 task done

run tasks without saving file #18764

RustoMCSpit opened this issue Oct 5, 2024 · 2 comments
Labels

Comments

@RustoMCSpit
Copy link

Check for existing issues

  • Completed

Describe the feature

i want to run code without saving it

If applicable, add mockups / screenshots to help present your vision of the feature

No response

@RustoMCSpit RustoMCSpit added admin read Pending admin review enhancement [core label] triage Maintainer needs to classify the issue labels Oct 5, 2024
@notpeter
Copy link
Member

notpeter commented Oct 5, 2024

I think we are unlikely to implement this for a number of reasons, but it would be possible with a few scripting languages to pass the script contents via stdin. Which language(s) were you looking for?

We wouldn't be able to trigger individual functions but we could run the entire script. Also some ambiguity of which directory it should be run from (home dir? project root? src dir? etc.).

echo 'print("hello world")' | python3 -
echo 'puts "hello world"' | ruby - 
echo 'echo "hello world"' | bash -
echo 'console.log("hello world")' | node -
echo 'print "hello world"' | lua -
echo 'print "hello world\n";' | perl -
echo "Write-Host 'Hello, World!'" | powershell.exe -Command -

You could probably do this today with custom task and the ZED_SELECTED_TEXT variable. Just have a task like echo ${ZED_SELECTED_TEXT} | python3 -. Then select all (cmd-a) and run.

@notpeter notpeter added tasks and removed triage Maintainer needs to classify the issue admin read Pending admin review labels Oct 5, 2024
@RustoMCSpit
Copy link
Author

RustoMCSpit commented Oct 5, 2024

Which language(s) were you looking for?

python. if i just want to test a small bit of code, a few lines, i dont want to waste time by saving and then deleting the file. just press f5 and run the code currently visible sort of thing like in other IDEs

you could probably just create a .temp file and delete it upon closing zed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants