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

Prompt with @input behaves differently when @input has no spaces in the string #3359

Closed
2 of 17 tasks
marckruzik opened this issue Dec 1, 2023 · 2 comments
Closed
2 of 17 tasks
Labels
bug Something isn't working

Comments

@marckruzik
Copy link
Contributor

Describe the bug

This example from the doc is working:

#!set --name url --value @input:"Please enter a URL"

Which gives a prompt Please enter a URL.

2023_12_01-16h19m39s-● Untitled-1 dib - notebook - Visual Studio Code

But if there is no space in the input, the prompt changes.

#!set --name url --value @input:"Please-enter-a-URL"

Which gives a prompt Please enter a value for field "Please-enter-a-URL"..
But it should give the prompt Please-enter-a-URL.

2023_12_01-16h20m00s-● Untitled-1 dib - notebook - Visual Studio Code

Same goes with a one word input such as "Age".

#!set --name url --value @input:"Age"

2023_12_01-16h23m05s-● Untitled-1 dib - notebook - Visual Studio Code

I think the intended behavior of @input is to specify the prompt, rather than having a wording about a field.
So in all cases, the prompt should be the content specified in @input.

Notes

Maybe there is a confusion with @input:input-please (notice the absence of double quotes), as seen in VariableSharingTests.SetMagicCommand.cs:

#!set --name newVar3 --value @input:input-please

This is an undocumented use of @input.
The behavior seems to be the same with @input:input-please (without double quotes) and @input:"input-please" (with double quotes): it asks for a field instead of using the text in place of the prompt.

Please complete the following:

Which version of .NET Interactive are you using? (In a notebook, run the #!about magic command. ):

Version: 1.0.456201+e5dc02dbdc933d895d722e69bfa98d580dcda8d9

  • OS
    • Windows 11
    • Windows 10
    • macOS
    • Linux (Please specify distro)
    • iOS
    • Android
  • Browser
    • Chrome
    • Edge
    • Firefox
    • Safari
  • Frontend
    • Jupyter Notebook
    • Jupyter Lab
    • nteract
    • Visual Studio Code
    • Visual Studio Code Insiders
    • Visual Studio
    • Other (please specify)
@jonsequitur jonsequitur added the bug Something isn't working label Dec 1, 2023
@jonsequitur
Copy link
Contributor

The current logic is that if there's no other option in the magic command to indicate a field name (e.g. the --name option for the #!set command), and the prompt is usable as a field name (e.g. has no spaces), then the field name is inferred from the prompt.

I'm fixing some of the quote behavior inconsistencies as part of the PR for #3323.

@jonsequitur
Copy link
Contributor

Under the new magic command parser, this syntax will always be treated as the input prompt. The concept of an input name is no longer present, as it's now always inferred from the associated parameter.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants