-
-
Notifications
You must be signed in to change notification settings - Fork 767
Open
Labels
questionQuestion or problemQuestion or problem
Description
First Check
- I added a very descriptive title to this issue.
- I used the GitHub search to find a similar issue and didn't find it.
- I searched the Typer documentation, with the integrated search.
- I already searched in Google "How to X in Typer" and didn't find any information.
- I already read and followed all the tutorial in the docs and didn't find an answer.
- I already checked if it is not related to Typer but to Click.
Commit to Help
- I commit to help with one of those options 👆
Example Code
import click
import typer
def validate_name_typer(ctx: typer.Context, param: typer.CallbackParam, value: str) -> str:
params = ctx.command.params # Autocompletion and syntax highlighting don't work
return value
def validate_name_click(ctx: click.Context, param: typer.CallbackParam, value: str) -> str:
params = ctx.command.params # Autocompletion and syntax highlighting work
return value
def main(name: str= typer.Option(...,callback=validate_name_typer)):
typer.echo(f"Hello {name}")
if __name__ == "__main__":
typer.run(main)
Description
On VSCode, I don't have autocompletion for the context in a callback. I am not sure where it comes from but this definitely seems a typer issue since it is working with Click.
I added both in the example.
EDIT: I am here trying to get other options from this callback.
Operating System
Linux
Operating System Details
$ cat /etc/os-release
NAME="Manjaro Linux"
ID=manjaro
ID_LIKE=arch
BUILD_ID=rolling
PRETTY_NAME="Manjaro Linux"
ANSI_COLOR="32;1;24;144;200"
HOME_URL="https://manjaro.org/"
DOCUMENTATION_URL="https://wiki.manjaro.org/"
SUPPORT_URL="https://manjaro.org/"
BUG_REPORT_URL="https://bugs.manjaro.org/"
LOGO=manjarolinux
Typer Version
0.4.0
Python Version
3.9.9
Additional Context
No response
Metadata
Metadata
Assignees
Labels
questionQuestion or problemQuestion or problem