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

stdin input #6

Open
Almenon opened this issue Feb 7, 2018 · 9 comments
Open

stdin input #6

Almenon opened this issue Feb 7, 2018 · 9 comments
Assignees
Labels
enhancement New feature or request help wanted Extra attention is needed misc

Comments

@Almenon
Copy link
Owner

Almenon commented Feb 7, 2018

a input box for stdin.

Please comment below or like if you want this feature.

@Almenon Almenon added the enhancement New feature or request label Feb 7, 2018
@Almenon Almenon self-assigned this Feb 8, 2018
@Almenon Almenon added this to the alpha v0.0.3 milestone Feb 8, 2018
@Almenon
Copy link
Owner Author

Almenon commented Feb 25, 2018

I coullldddd create a command for input and call that from the preview:

https://code.visualstudio.com/docs/extensionAPI/vscode-api-commands

But at this point it might be better to wait for the new preview API

microsoft/vscode#43713

@Almenon Almenon removed this from the alpha v0.0.3 milestone Feb 25, 2018
@Almenon
Copy link
Owner Author

Almenon commented Mar 9, 2018

a user on discord just asked about this - that's a sign that i maybe i should bump this up the priority list

@Almenon Almenon modified the milestones: v0.1.4, v0.1.5 Jul 27, 2018
@Almenon Almenon modified the milestones: v0.1.5, v0.1.6 Aug 31, 2018
@Almenon Almenon removed their assignment Aug 31, 2018
@Almenon Almenon modified the milestones: v0.1.6, v0.1.7 Sep 18, 2018
@Almenon Almenon modified the milestones: v1.0.1, v1.1.0 Oct 14, 2018
@Almenon Almenon modified the milestones: v1.1.0, v1.2.0 Dec 10, 2018
@paulbmouton
Copy link

This would be great to see added. Just started using the add-on today and it is very helpful.

@Almenon
Copy link
Owner Author

Almenon commented Dec 14, 2018

@itsbennett I'll start work on this today.

One reason I've been avoiding this is stdin along with real time evaluation is problematic - you have to enter in new stdin each time you make a change, which can quickly get annoying. But I just had a idea for that - there could be a stdin textarea that would send the text to stdin each execution.

In the meantime while you are waiting for this feature I suggest overloading stdin. If you look at the wiki I have a guide here: https://github.com/Almenon/AREPL-vscode/wiki/Using-AREPL-with-coding-challenges

dependency upon #146

@Almenon Almenon modified the milestones: v1.2.0, v1.0.5 Dec 16, 2018
@Almenon
Copy link
Owner Author

Almenon commented Dec 16, 2018

another user asked for this so bumping it up in priority. Hopefully will get this done by end of year

@Almenon Almenon self-assigned this Dec 16, 2018
@Almenon
Copy link
Owner Author

Almenon commented Dec 18, 2018

The textarea idea ran into some complications - it's still doable but will take longer than I thought.

But this morning I had idea for a even simpler approach. input() could tell the user to hardcode the stdin, like so:

input() # prints AREPL requires stdin to be hardcoded, like so: standardInput = 'hello world'; print(input())
standardInput = "hello world"
print(input()) # prints hello world

Stdin() would check for the existance of a standardInput variable and if it exists it would return it line-by-line.

The only major problem with this approach is that if other libraries or files that use stdin will still cause arepl up. So it can't be a permenant solution - eventually I will have to move to a textarea in the preview window.

Does the temporary fix look good @itsbennett ?

@Almenon
Copy link
Owner Author

Almenon commented Dec 18, 2018

rasied Almenon/AREPL-backend#60

@Almenon Almenon pinned this issue Dec 20, 2018
@Almenon
Copy link
Owner Author

Almenon commented Dec 29, 2018

No response from bennett. I should probably just go ahead with the temporary fix to be able to get a release out for the new year.

Almenon added a commit that referenced this issue Dec 29, 2018
@Almenon Almenon removed this from the v1.0.5 milestone Dec 29, 2018
@Almenon
Copy link
Owner Author

Almenon commented Dec 29, 2018

@itsbennett I released the temporary fix with 1.0.5

You can hardcode stdin in three ways:

def standard_input():
    yield 'hello'
    yield 'world'
standard_input = ["hello", "world"]
standard_input = "hello\nworld"

@Almenon Almenon added the help wanted Extra attention is needed label Jan 31, 2019
@Almenon Almenon added the misc label Dec 22, 2019
@Almenon Almenon unpinned this issue Jan 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed misc
Projects
None yet
Development

No branches or pull requests

2 participants