{"id":27254805,"url":"https://github.com/pschanely/crosshair-vscode","last_synced_at":"2025-04-11T02:08:41.437Z","repository":{"id":44830666,"uuid":"333681495","full_name":"pschanely/crosshair-vscode","owner":"pschanely","description":"Use crosshair to statically analyze Python code from within VS Code.","archived":false,"fork":false,"pushed_at":"2022-11-01T17:30:51.000Z","size":1631,"stargazers_count":6,"open_issues_count":3,"forks_count":0,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-04-11T02:08:33.378Z","etag":null,"topics":["contract","contract-testing","hacktoberfest","python","vscode","vscode-extension"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pschanely.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-01-28T07:35:13.000Z","updated_at":"2023-01-03T12:22:25.000Z","dependencies_parsed_at":"2023-01-21T05:06:11.478Z","dependency_job_id":null,"html_url":"https://github.com/pschanely/crosshair-vscode","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pschanely%2Fcrosshair-vscode","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pschanely%2Fcrosshair-vscode/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pschanely%2Fcrosshair-vscode/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pschanely%2Fcrosshair-vscode/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pschanely","download_url":"https://codeload.github.com/pschanely/crosshair-vscode/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248328161,"owners_count":21085261,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["contract","contract-testing","hacktoberfest","python","vscode","vscode-extension"],"created_at":"2025-04-11T02:08:40.563Z","updated_at":"2025-04-11T02:08:41.416Z","avatar_url":"https://github.com/pschanely.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# crosshair-vscode\n\nCrosshair-vscode is an extension for [Visual Studio Code (VS Code)][vscode] that\nallows you to statically test your Python code using [CrossHair][crosshair-tool].\n\n## Installation\n\nCrosshair-vscode has two dependencies:\n* The Python extension [ms-python.python][ms-python.python] for\n  [VS Code][vscode], and\n* The Python packages [crosshair-tool][crosshair-tool] and [pygls][pygls].\n\n**ms-python.python**.\nUse the Visual Studio marketplace to install the extension ms-python.python by\nfollowing [this link][ms-python.python].\n\n**crosshair-tool**. The easiest way to install the\n[crosshair-tool][crosshair-tool] and [pygls][pygls] packages is to open the terminal tab and run pip3:\n\n```\npip3 install crosshair-tool pygls\n```\n\nThese packages must be installed in each Python environment that you wish to use. (the environment is displayed and can be changed in the status bar)\n\n**crosshair-vscode**.\nUse the Visual Studio marketplace to install the extension by\nfollowing [this link][crosshair-vscode].\n\n[vscode]: https://code.visualstudio.com/\n[ms-python.python]: https://marketplace.visualstudio.com/items?itemName=ms-python.python\n[crosshair-tool]: https://pypi.org/project/crosshair-tool/\n[pygls]: https://pypi.org/project/pygls/\n[venv]: https://docs.python.org/3/tutorial/venv.html\n[vscode-venv]: https://code.visualstudio.com/docs/python/environments\n[crosshair-vscode]: https://marketplace.visualstudio.com/items?itemName=CrossHair.crosshair\n\n## Usage\n\nThe extension can be accessed from the status bar. When editing Python files, you'll see a new item labeled \"CH off\" (or \"CH on\" if the background watcher is already running).\n\n\u003cimg src=\"https://raw.githubusercontent.com/pschanely/crosshair-vscode/main/readme/status-bar-item.png\" width=100 alt=\"status bar item\" /\u003e\n\nClick on this item to open a menu and perform various commands.\n\n\u003cimg src=\"https://raw.githubusercontent.com/pschanely/crosshair-vscode/main/readme/quick-pick.png\" width=450 alt=\"crosshair menu\" /\u003e\n\nMost importantly, you'll want to start the background watcher; by default, it does not auto-start. Once started, CrossHair will attempt to detect contract counterexamples in the background. When it finds something, you'll see it highlighted like this:\n\n\u003cimg src=\"https://raw.githubusercontent.com/pschanely/crosshair-vscode/main/readme/example-error.png\" width=550 alt=\"example crosshair error\" /\u003e\n\n\nNOTE: To reduce wasteful computation, the background watcher only checks contracts in files that are open. You may decide to leave some files open to ensure some contracts continue to be checked as you work.\n\nIf you want to be even more targeted by just checking an individual file, use the \"watch in terminal\" command.\n\n\n## Commands\n\nThe extension defines the following commands:\n\n* `crosshair-vscode.pick`. Show a quick pick that allows you to select a command\n  to execute.\n  \n  This is handy if you do not want to memorize individual commands, and want to set up\n  a single keyboard shortcut to invoke crosshair-vscode.\n\n* `crosshair-vscode.start`. Start the background watcher process.\n\n* `crosshair-vscode.stop`. Start the background watcher process.\n\n* `crosshair-vscode.watch`. Open a new terminal watching a file with crosshair.\n\n   There is an optional argument indicating the path to a file.\n   If no path is given, watch the current active file in the editor.\n\n* `crosshair-vscode.gentests`. Produce tests for the function at the current cursor position.\n\n\n## Settings\n\nSearch your VSCode settings for \"crosshair\" to see the options that you can configure. Here, you can do things like set project-specific contract types (icontract vs asserts) and change whether the background watcher automatically starts.\n\n## Known Issues\n\nIt is hard to control terminals in VS Code (see\n[this issue](https://github.com/microsoft/vscode-python/issues/15197)).\nWe wait for a short delay (~1 second) till we send commands to the terminal.\nThis might cause racing conditions in some rare cases.\n\n## Contributing\n\nPlease see [CONTRIBUTING.md] for how to help us with development of the extension.\n\n## Credits\n\nThis plugin was authored by\n[Marko Ristin](https://github.com/mristin)\nand is now maintained by [Phillip Schanely](https://github.com/pschanely).\n\n## Versioning\n\nWe follow a bit unusual semantic versioning schema:\n\n* X is the oldest supported major version of\n  [crosshair-tool],\n* Y is the minor version (odd numbers are pre-release versions), and\n* Z is the patch version (only bug fixes).\n\n## Release Notes\n\n### 0.0.1\n\nInitial release of crosshair-vscode.\n\n### 0.0.2\n\nCrossHair now runs transparently in the background and highlights counterexamples directly in your code, just like a typechecker or linter would.\nYou can stop or start CrossHair in the status bar.\nSome of the more specialized check commands have been removed, as background execution is the recommended way to use CrossHair.\n\n### 0.2.0\n\nA non-pre-release release of 0.0.2; there are no changes.\n(We're moving to the VSCode recommendation of using even minor version numbers for release versions)\n\n### 0.2.1\n\nRemoves the possibility for leaked CrossHair workers when closing the editor window without explicitly stopping the background runner.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpschanely%2Fcrosshair-vscode","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpschanely%2Fcrosshair-vscode","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpschanely%2Fcrosshair-vscode/lists"}