Skip to content

Commit

Permalink
fix daemon for vscode
Browse files Browse the repository at this point in the history
  • Loading branch information
KotlinIsland committed Dec 1, 2024
1 parent 163ccad commit dd7178d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
### Fixes
- check type args on type aliases (#817)
- cache modules that only have baseline errors
- fix dmypy in vscode
### Docs
- correct error code documentation regarding defaults

Expand Down
13 changes: 8 additions & 5 deletions mypy/dmypy/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,7 @@ def __init__(self, prog: str) -> None:
"--status-file", default=DEFAULT_STATUS_FILE, help="status file to retrieve daemon details"
)
parser.add_argument(
"-V",
"--version",
action="version",
version=f"Basedmypy-Daemon {__based_version__}\nBased on %(prog)s {__version__}",
help="Show program's version number and exit",
"-V", "--version", action="store_true", help="Show program's version number and exit"
)
subparsers = parser.add_subparsers()

Expand Down Expand Up @@ -274,6 +270,13 @@ def main(argv: list[str]) -> None:
"""The code is top-down."""
check_python_version("dmypy")
args = parser.parse_args(argv)
if args.version:
if "VSCODE_PID" in os.environ:
# vscode is looking for upstreams output
print(f"dmypy {__version__}")
else:
print(f"Basedmypy-Daemon {__based_version__}\nBased on dmypy {__version__}")
return
if not args.action:
parser.print_usage()
else:
Expand Down

0 comments on commit dd7178d

Please sign in to comment.