### Install cargo-insta Source: https://github.com/posit-dev/air/blob/main/crates/air_r_formatter/README.md Install the cargo-insta tool, which is required for running tests. ```sh cargo install cargo-insta ``` -------------------------------- ### Install Air using uv tool Source: https://github.com/posit-dev/air/blob/main/README.md Install the air-formatter package globally using the uv tool. This command also shows how to invoke Air without a global installation. ```bash # Global install uv tool install air-formatter air format path/to/my/script.R # Invoke once without installing uvx --from air-formatter air format path/to/my/script.R ``` -------------------------------- ### Install Air on Windows Source: https://github.com/posit-dev/air/blob/main/README.md Use this PowerShell command to download and execute the Air installer script on Windows systems. ```powershell powershell -ExecutionPolicy Bypass -c "irm https://github.com/posit-dev/air/releases/latest/download/air-installer.ps1 | iex" ``` -------------------------------- ### Install Positron Extension Development Version Source: https://github.com/posit-dev/air/blob/main/CONTRIBUTING.md Installs the development version of the Air extension for Positron. This involves packaging the extension and then installing it using the positron CLI. ```bash (cd editors/code && (rm -rf *.vsix || true) && npx @vscode/vsce package && positron --install-extension *.vsix) ``` -------------------------------- ### Global install of a specific air-formatter version Source: https://github.com/posit-dev/air/blob/main/python/README.md Installs a specific version of air-formatter globally using uv. ```bash # Global install uv tool install air-formatter@0.8.2 ``` -------------------------------- ### Install Air using Homebrew on macOS Source: https://github.com/posit-dev/air/blob/main/README.md Install the Air formula using Homebrew on macOS systems. ```bash brew install air ``` -------------------------------- ### Install Air on macOS and Linux Source: https://github.com/posit-dev/air/blob/main/README.md Use this command to download and execute the Air installer script on macOS and Linux systems. ```bash curl -LsSf https://github.com/posit-dev/air/releases/latest/download/air-installer.sh | sh ``` -------------------------------- ### Install air-formatter with uv Source: https://github.com/posit-dev/air/blob/main/python/README.md Installs the air-formatter globally using the uv tool. This makes the 'air' command available on your system's PATH. ```bash uv tool install air-formatter ``` -------------------------------- ### Running Tests with Cargo Source: https://github.com/posit-dev/air/blob/main/crates/tests_macros/README.md Provides command-line examples for running tests using Cargo. It shows how to run all tests, tests for a specific crate, tests within a specific module, or a single test. ```bash > cargo test // all tests in all crates > cargo test -p crate-name // all tests of one crate > cargo test -p crate-name -- some_mod:: // all tests of one crate and one module > cargo test -p crate-name -- some_mod::somefilename // just one test ``` -------------------------------- ### Install air-formatter with pip Source: https://github.com/posit-dev/air/blob/main/python/README.md Installs the air-formatter using pip. This also adds the 'air' command to your system's PATH. ```bash pip install air-formatter ``` -------------------------------- ### Install a Specific Version of Air on Windows Source: https://github.com/posit-dev/air/blob/main/README.md Download and execute the Air installer script for a specific version (e.g., 0.9.0) on Windows. ```powershell powershell -ExecutionPolicy Bypass -c "irm https://github.com/posit-dev/air/releases/download/0.9.0/air-installer.ps1 | iex" ``` -------------------------------- ### Install VS Code Extension Development Version Source: https://github.com/posit-dev/air/blob/main/CONTRIBUTING.md Installs the development version of the Air extension for VS Code. This process includes packaging the extension and installing it via the 'code' CLI command. ```bash (cd editors/code && (rm -rf *.vsix || true) && npx @vscode/vsce package && code --install-extension *.vsix) ``` -------------------------------- ### Install a Specific Version of Air on macOS and Linux Source: https://github.com/posit-dev/air/blob/main/README.md Download and execute the Air installer script for a specific version (e.g., 0.9.0) on macOS and Linux. ```bash curl -LsSf https://github.com/posit-dev/air/releases/download/0.9.0/air-installer.sh | sh ``` -------------------------------- ### Install Air Zed Extension Development Version Source: https://github.com/posit-dev/air/blob/main/CONTRIBUTING.md Installs the development version of the Air extension for Zed by selecting the 'editors/zed' directory. This process creates an 'extension.wasm' file. ```bash zed: install dev extension ``` -------------------------------- ### One-off formatting with uvx Source: https://github.com/posit-dev/air/blob/main/python/README.md Invokes the air formatter for a single task without a global installation, using uvx. ```bash uvx --from air-formatter air format path/to/file.R ``` -------------------------------- ### Format an R file with air Source: https://github.com/posit-dev/air/blob/main/python/README.md Demonstrates the basic command to format a single R file using the installed air tool. ```bash # Format R file air format path/to/file.R ``` -------------------------------- ### Build Air CLI Development Version Source: https://github.com/posit-dev/air/blob/main/CONTRIBUTING.md Builds the development version of the Air CLI. This command does not install the CLI but compiles it to a debug binary. ```bash cargo build ``` -------------------------------- ### Run and Review Air Formatter Tests Source: https://github.com/posit-dev/air/blob/main/crates/air_r_formatter/README.md Execute tests using cargo-insta and review the results. ```sh cargo insta test ``` ```sh cargo insta review ``` -------------------------------- ### Build and Run Python Wheel Locally Source: https://github.com/posit-dev/air/blob/main/CONTRIBUTING.md Local commands to build a Python wheel for Air and then run it. This process involves building the release version of Air and packaging it. ```bash just build-wheel ``` ```bash just run-wheel ``` -------------------------------- ### Format all R files in a directory with air Source: https://github.com/posit-dev/air/blob/main/python/README.md Shows how to use the air tool to format all R files within a specified directory. ```bash # Format all R files in a directory air format path/to/directory/ ``` -------------------------------- ### Generate Formatter Source Files Source: https://github.com/posit-dev/air/blob/main/crates/air_r_formatter/README.md Generate the src/generated.rs file using the 'just gen-formatter' command. ```sh just gen-formatter ``` -------------------------------- ### One-off formatting with a specific air-formatter version Source: https://github.com/posit-dev/air/blob/main/python/README.md Executes a specific version of air-formatter for a single task using uvx. ```bash # One off runs uvx --from air-formatter@0.8.2 air format path/to/file.R ``` -------------------------------- ### Run Local Tests with nextest Source: https://github.com/posit-dev/air/blob/main/CONTRIBUTING.md Executes all local tests using the 'just test' command, which internally calls 'cargo nextest run'. This framework runs each test in a separate process for isolation. ```bash just test ``` -------------------------------- ### Run Insta Snapshot Tests in Update Mode Source: https://github.com/posit-dev/air/blob/main/CONTRIBUTING.md Updates existing snapshot tests using the 'just test-insta' command. This is useful for regenerating snapshots when expected output has changed. ```bash just test-insta ``` -------------------------------- ### Generated Test Function Structure Source: https://github.com/posit-dev/air/blob/main/crates/tests_macros/README.md Illustrates the structure of a unit test function automatically generated by the tests_macros crate. It shows how file paths are constructed and passed to the test runner function. ```rust #[test] pub fn somefilename() { let test_file = "/tests/sometest.txt"; let test_expected_file = "/tests/sometest.expected.txt"; run_test(test_file, test_expected_file); } ``` -------------------------------- ### Rebuild Air Zed Extension Source: https://github.com/posit-dev/air/blob/main/CONTRIBUTING.md Rebuilds the Air extension within Zed. This is done through the Zed extension manager by finding the 'Air' extension and clicking 'Rebuild'. ```bash zed: extensions ``` -------------------------------- ### Enable Format on Save for R Files Source: https://github.com/posit-dev/air/blob/main/editors/code/README.md Configure your VS Code settings to automatically format R files on save using the Air extension. This JSON snippet should be added to your settings.json file. ```json { "[r]": { "editor.formatOnSave": true } } ``` -------------------------------- ### Generate Tests Macro Usage Source: https://github.com/posit-dev/air/blob/main/crates/tests_macros/README.md Defines a module with the gen_tests! macro to automatically generate unit tests. The macro takes a glob pattern and a callback function to run for each matched file. ```rust mod some_mod { tests_macros::gen_tests!{"tests/*.{js,json}", run_test} // input_file and expected_file are full paths fn run_test(input_file: &str, expected_file: &str) { println!("{:?} {:?}", input_file, expected_file); } } ``` -------------------------------- ### Update Air Submodule in Zed Extensions Source: https://github.com/posit-dev/air/blob/main/CONTRIBUTING.md Commands to update the Air submodule within the zed-industries/extensions repository to a specific commit. Ensure you are in the correct directory before executing. ```bash cd extensions/air git fetch origin git checkout cd ../.. git add extensions/air ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.