diff --git a/.editorconfig b/.editorconfig index b429316..b2d50c7 100644 --- a/.editorconfig +++ b/.editorconfig @@ -1,2 +1,8 @@ +root = true + [*] indent_size = 2 +indent_style = space +insert_final_newline = true +max_line_length = 100 +trim_trailing_whitespace = true diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 5055b7b..17aff61 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -1,3 +1 @@ -/crates/cairo-lang-doc @orizi @mkaput @Arcticae @Draggu @piotmag769 @integraledelebesgue -/crates/cairo-lang-language-server @orizi @mkaput @Arcticae @Draggu @piotmag769 @integraledelebesgue -/vscode-cairo @orizi @mkaput @Arcticae @Draggu @piotmag769 @integraledelebesgue +* @software-mansion/cairo-ls diff --git a/.github/ISSUE_TEMPLATE/01_BUG_REPORT.md b/.github/ISSUE_TEMPLATE/01_BUG_REPORT.md deleted file mode 100644 index 9a0bfdf..0000000 --- a/.github/ISSUE_TEMPLATE/01_BUG_REPORT.md +++ /dev/null @@ -1,37 +0,0 @@ ---- -name: Bug Report -about: Create a report to help Cairo to improve -title: "bug: " -labels: "bug" -assignees: "" ---- - -# Bug Report - -**Cairo version:** - - - -**Current behavior:** - - - -**Expected behavior:** - - - -**Steps to reproduce:** - - - -**Related code:** - - - -``` -insert short code snippets here -``` - -**Other information:** - - diff --git a/.github/ISSUE_TEMPLATE/02_FEATURE_REQUEST.md b/.github/ISSUE_TEMPLATE/02_FEATURE_REQUEST.md deleted file mode 100644 index 5719147..0000000 --- a/.github/ISSUE_TEMPLATE/02_FEATURE_REQUEST.md +++ /dev/null @@ -1,35 +0,0 @@ ---- -name: Feature Request -about: Suggest an idea for this project -title: "feat: " -labels: "enhancement" -assignees: "" ---- - -# Feature Request - -**Describe the Feature Request** - - - -**Describe Preferred Solution** - - - -**Describe Alternatives** - - - -**Related Code** - - - -**Additional Context** - - - -**If the feature request is approved, would you be willing to submit a PR?** -_(Help can be provided if you need assistance submitting a PR)_ - -- [ ] Yes -- [ ] No diff --git a/.github/ISSUE_TEMPLATE/03_CODEBASE_IMPROVEMENT.md b/.github/ISSUE_TEMPLATE/03_CODEBASE_IMPROVEMENT.md deleted file mode 100644 index bcd6cb7..0000000 --- a/.github/ISSUE_TEMPLATE/03_CODEBASE_IMPROVEMENT.md +++ /dev/null @@ -1,7 +0,0 @@ ---- -name: Codebase improvement -about: Provide your feedback for the existing codebase. Suggest a better solution for algorithms, development tools, etc. -title: "dev: " -labels: "enhancement" -assignees: "" ---- diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml new file mode 100644 index 0000000..6c94393 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.yml @@ -0,0 +1,53 @@ +name: Bug Report +description: Create a report to help us improve +labels: ["bug"] +body: + - type: markdown + attributes: + value: Thanks for filing a 🐛 bug report 😄! + - type: textarea + id: problem + attributes: + label: Problem + description: > + Please provide a clear and concise description of what the bug is, + including what currently happens and what you expected to happen. + validations: + required: true + - type: textarea + id: steps + attributes: + label: Steps + description: Please list the steps to reproduce the bug. + placeholder: | + 1. + 2. + 3. + - type: textarea + id: possible-solutions + attributes: + label: Possible Solution(s) + description: > + Not obligatory, but suggest a fix/reason for the bug, + or ideas how to implement the addition or change. + - type: textarea + id: notes + attributes: + label: Notes + description: Provide any additional notes that might be helpful. + - type: textarea + id: scarb-version + attributes: + label: Scarb Version + description: > + Please paste the output of running `scarb --version`. + Remember to do this in the affected project directory. + render: text + - type: textarea + id: vscode-version + attributes: + label: Visual Studio Code Version + description: > + Please paste version information about Visual Studio Code. + You can obtain it from the "About" dialog. + render: text diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml index 7d5bd89..507b808 100644 --- a/.github/ISSUE_TEMPLATE/config.yml +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -1,6 +1,4 @@ ---- -blank_issues_enabled: false contact_links: - - name: Cairo Community Support - url: https://github.com/starkware-libs/cairo/discussions - about: Please ask and answer questions here. + - name: Cairo Language Server Telegram Channel + url: https://t.me/cairo_ls_support + about: Have a question or issue? Chat with the community and developers here. diff --git a/.github/ISSUE_TEMPLATE/feature_request.yml b/.github/ISSUE_TEMPLATE/feature_request.yml new file mode 100644 index 0000000..f1088fa --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature_request.yml @@ -0,0 +1,35 @@ +name: Feature Request +description: Suggest an idea for enhancing Cairo extension for Visual Studio Code +labels: ["enhancement"] +body: + - type: markdown + attributes: + value: | + Thanks for filing a 🙋 feature request 😄! + + If the feature request is relatively small and already with a possible solution, this might be the place for you. + + If you are brewing a big feature that needs feedback from the community, [the CairoLS Telegram channel][tg] is the best fit. + You can also talk the idea over with other developers over there. + + [tg]: https://t.me/cairo_ls_support + - type: textarea + id: problem + attributes: + label: Problem + description: > + Please provide a clear description of your use case and the problem + this feature request is trying to solve. + validations: + required: true + - type: textarea + id: solution + attributes: + label: Proposed Solution + description: > + Please provide a clear and concise description of what you want to happen. + - type: textarea + id: notes + attributes: + label: Notes + description: Provide any additional context or information that might be helpful. diff --git a/.github/workflows/artifacts.yml b/.github/workflows/artifacts.yml deleted file mode 100644 index 83279ba..0000000 --- a/.github/workflows/artifacts.yml +++ /dev/null @@ -1,19 +0,0 @@ -name: Crate Artifacts -on: workflow_dispatch -jobs: - create_artifacts: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - uses: actions-rs/toolchain@v1 - with: - toolchain: stable - - name: Install musl tools. - run: sudo apt-get install -y musl-tools - - name: Build in unknown linux - run: ./scripts/release_tar.sh x86_64-unknown-linux-musl - - name: Archive artifacts - uses: actions/upload-artifact@v3 - with: - name: release-x86_64-unknown-linux-musl - path: target/x86_64-unknown-linux-musl.tar.gz diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml new file mode 100644 index 0000000..6b2e141 --- /dev/null +++ b/.github/workflows/ci.yaml @@ -0,0 +1,27 @@ +name: CI + +on: + push: + branches: + - main + pull_request: + merge_group: + +permissions: + contents: read + +jobs: + fmt-and-lint: + name: format, lint and test + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version: "22.x" + cache: npm + - run: npm ci + - run: npm run lint-fmt + - run: npm run lint-eslint + - run: npm run compile-test + - run: npm test diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml deleted file mode 100644 index 1327dde..0000000 --- a/.github/workflows/ci.yml +++ /dev/null @@ -1,171 +0,0 @@ -name: CI - -on: - push: - branches: [ main ] - pull_request: - merge_group: - types: [ checks_requested ] - -jobs: - ensure-no_std: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - uses: dtolnay/rust-toolchain@master - with: - toolchain: nightly-2024-11-23 - targets: wasm32-unknown-unknown - - uses: Swatinem/rust-cache@v2 - - run: | - cd ensure-no_std && cargo build - - parallel-tests: - runs-on: ubuntu-latest - strategy: - matrix: - cmd: - - test --profile=ci-dev -p cairo-lang-casm --features=serde,parity-scale-codec,schemars - - test --profile=ci-dev -p cairo-lang-casm --no-default-features --features=serde,parity-scale-codec - - test --profile=ci-dev -p cairo-lang-compiler - - test --profile=ci-dev -p cairo-lang-debug - - test --profile=ci-dev -p cairo-lang-defs - - test --profile=ci-dev -p cairo-lang-diagnostics - - test --profile=ci-dev -p cairo-lang-doc - - test --profile=ci-dev -p cairo-lang-eq-solver - - test --profile=ci-dev -p cairo-lang-filesystem - - test --profile=ci-dev -p cairo-lang-formatter - - test --profile=ci-dev -p cairo-lang-language-server - - test --profile=ci-dev -p cairo-lang-lowering - - test --profile=ci-dev -p cairo-lang-parser - - test --profile=ci-dev -p cairo-lang-plugins - - test --profile=ci-dev -p cairo-lang-proc-macros - - test --profile=ci-dev -p cairo-lang-project - - test --profile=ci-dev -p cairo-lang-runnable - - test --profile=ci-dev -p cairo-lang-runnable-utils - - test --profile=ci-dev -p cairo-lang-runner - - test --profile=ci-dev -p cairo-lang-semantic - - test --profile=ci-dev -p cairo-lang-sierra - - test --profile=ci-dev -p cairo-lang-sierra-ap-change - - test --profile=ci-dev -p cairo-lang-sierra-gas - - test --profile=ci-dev -p cairo-lang-sierra-generator - - test --profile=ci-dev -p cairo-lang-sierra-to-casm - - test --profile=ci-dev -p cairo-lang-sierra-type-size - - test --profile=ci-dev -p cairo-lang-starknet-classes - - test --profile=ci-dev -p cairo-lang-starknet - - test --profile=ci-dev -p cairo-lang-syntax - - test --profile=ci-dev -p cairo-lang-syntax-codegen - - test --profile=ci-dev -p cairo-lang-test-plugin - - test --profile=ci-dev -p cairo-lang-test-runner - - test --profile=ci-dev -p cairo-lang-test-utils - - test --profile=ci-dev -p cairo-lang-utils --features=serde,parity-scale-codec,schemars,testing,env_logger - - test --profile=ci-dev -p cairo-lang-utils --no-default-features --features=serde,parity-scale-codec - - test --profile=ci-dev -p tests - steps: - - uses: actions/checkout@v4 - - uses: dtolnay/rust-toolchain@master - with: - components: rustfmt - toolchain: nightly-2024-11-23 - - uses: dtolnay/rust-toolchain@stable - - uses: Swatinem/rust-cache@v2 - - name: Install nextest - uses: taiki-e/install-action@nextest - # Validates that the number of commands in the matrix is equal to the number of crates in the - # workspace + 2 (for the crates which have multiple commands) - - run: | - CRATES_COUNT=$(find {crates/*,tests}/Cargo.toml | wc -l) - COMMANDS_COUNT=${{ strategy.job-total }} - if [ $((CRATES_COUNT + 2)) -ne $COMMANDS_COUNT ]; then - echo "CRATES_COUNT: $CRATES_COUNT" - echo "COMMANDS_COUNT: $COMMANDS_COUNT" - echo "The number of commands in the matrix is not equal to the number of crates in the workspace + 2" - exit 1 - fi - - run: | - cargo ${{ matrix.cmd }} - test: - if: ${{ always() }} - needs: parallel-tests - runs-on: ubuntu-latest - steps: - - if: needs.parallel-tests.result == 'success' - run: exit 0 - - if: needs.parallel-tests.result != 'success' - run: exit 1 - rustfmt: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - uses: dtolnay/rust-toolchain@master - with: - components: rustfmt - toolchain: nightly-2024-11-23 - - uses: Swatinem/rust-cache@v2 - - run: scripts/rust_fmt.sh --check - - # Checks all .cairo files in the repo are formatted correctly. - cairofmt: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - uses: dtolnay/rust-toolchain@stable - - uses: Swatinem/rust-cache@v2 - - run: scripts/cairo_fmt.sh --check - - # Checks all cairo corelib tests run correctly. - cairotest: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - uses: dtolnay/rust-toolchain@stable - - uses: Swatinem/rust-cache@v2 - - run: scripts/cairo_test.sh - - run: scripts/starknet_test.sh - - # Check for unnecessary dependencies. - udeps: - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v4 - - name: Machete - uses: bnjbvr/cargo-machete@main - - clippy: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - uses: dtolnay/rust-toolchain@master - with: - components: clippy - toolchain: nightly-2024-11-23 - - uses: Swatinem/rust-cache@v2 - - run: > - scripts/clippy.sh - - typos: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - uses: crate-ci/typos@v1.27.0 - - docs: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - uses: dtolnay/rust-toolchain@master - with: - toolchain: nightly-2024-11-23 - - uses: Swatinem/rust-cache@v2 - - run: > - scripts/docs.sh - - sierra-updated-check: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - with: - fetch-depth: '0' - - run: > - scripts/sierra_update_check.sh origin/$GITHUB_BASE_REF origin/$GITHUB_HEAD_REF diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index 7929cd0..5f82eb3 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -2,66 +2,17 @@ name: Nightly on: schedule: - # Runs the end of every day. - cron: "0 0 * * *" -env: - RUSTUP_TOOLCHAIN: nightly +permissions: + contents: read jobs: - rustfmt: + check-cairo-snippets: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - uses: dtolnay/rust-toolchain@nightly + - uses: actions/setup-node@v4 with: - components: rustfmt - - uses: Swatinem/rust-cache@v2 - - run: scripts/rust_fmt.sh --check - - clippy: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - uses: dtolnay/rust-toolchain@nightly - with: - components: clippy - - uses: Swatinem/rust-cache@v2 - - run: > - scripts/clippy.sh - - docs: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - uses: dtolnay/rust-toolchain@nightly - - uses: Swatinem/rust-cache@v2 - - run: > - scripts/docs.sh - - typos: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - uses: crate-ci/typos@master - - starknet_sierra_validate: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - uses: dtolnay/rust-toolchain@nightly - - uses: Swatinem/rust-cache@v2 - - run: > - scripts/starknet_sierra_validate.sh https://papyrus-integration-mainnet.sw-dev.io/rpc/v0_7 - - run: > - scripts/starknet_sierra_validate.sh https://papyrus-integration-sepolia-testnet.sw-dev.io/rpc/v0_7 - - vscode-cairo-check-cairo-snippets: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-node@v3 - with: - node-version: '22.x' - - run: > - scripts/vscode-cairo-check-cairo-snippets.sh + node-version: "22.x" + - run: bin/check-cairo-snippets.sh diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml deleted file mode 100644 index c2bd35d..0000000 --- a/.github/workflows/release.yaml +++ /dev/null @@ -1,40 +0,0 @@ -name: release -on: - push: - tags: - - "v*" - -jobs: - release: - name: Publish for ${{ matrix.os }} - runs-on: ${{ matrix.os }} - strategy: - matrix: - include: - - os: ubuntu-latest - artifact_name: x86_64-unknown-linux-musl.tar.gz - asset_name: release-x86_64-unknown-linux-musl.tar.gz - target: x86_64-unknown-linux-musl - - os: macos-latest - artifact_name: aarch64-apple-darwin.tar.gz - asset_name: release-aarch64-apple-darwin.tar - target: aarch64-apple-darwin - steps: - - uses: actions/checkout@v4 - - name: Install musl - run: | - if [ "${{ matrix.target }}" == "x86_64-unknown-linux-musl" ] - then - sudo apt-get install -y musl-tools - fi - - name: Build in ${{ matrix.target }} - run: ./scripts/release_tar.sh ${{ matrix.target }} - - name: Upload binaries to release - uses: svenstaro/upload-release-action@v2 - with: - repo_token: ${{ secrets.GITHUB_TOKEN }} - file: target/${{ matrix.artifact_name }} - asset_name: ${{ matrix.asset_name }} - tag: ${{ github.ref }} - overwrite: true - body: "Cairo compiler." diff --git a/.github/workflows/tree-sitter.yml b/.github/workflows/tree-sitter.yml deleted file mode 100644 index 52bc330..0000000 --- a/.github/workflows/tree-sitter.yml +++ /dev/null @@ -1,41 +0,0 @@ -name: Tree sitter -on: - schedule: - - cron: "0 0 * * *" - -jobs: - test: - name: Test tree-sitter parser - runs-on: ubuntu-latest - strategy: - fail-fast: false - steps: - - name: Checkout repository - uses: actions/checkout@v4 - - name: Set up tree-sitter - uses: tree-sitter/setup-action/cli@v1 - - name: Clone tree-sitter-repo - run: |- - git clone https://github.com/starkware-libs/tree-sitter-cairo --single-branch --depth=1 --filter=blob:none - mv tree-sitter-cairo/** . - - name: Parse examples - uses: tree-sitter/parse-action@v4 - with: - files: ./**/*.cairo - invalid-files: crates/cairo-lang-parser/src/parser_test_data/cairo_test_files/*.cairo - - notify_failed: - runs-on: ubuntu-latest - # Do not run on dry_run or success - if: always() && !(inputs.dry_run) && contains(needs.*.result, 'failure') - needs: [ test ] - steps: - - name: Notifying about Nightly fail! - uses: slackapi/slack-github-action@v1.26.0 - env: - SLACK_WEBHOOK_URL: ${{ secrets.SLACK_TREE_SITTER_FAILURE_WEBHOOK }} - with: - payload: | - { - "url": "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}" - } diff --git a/.github/workflows/vscode-cairo-ci.yaml b/.github/workflows/vscode-cairo-ci.yaml deleted file mode 100644 index 102c45a..0000000 --- a/.github/workflows/vscode-cairo-ci.yaml +++ /dev/null @@ -1,32 +0,0 @@ -name: VSCode Cairo Extension CI - -on: - push: - branches: - - main - paths: - - 'vscode-cairo/**' - pull_request: - paths: - - 'vscode-cairo/**' - merge_group: - -jobs: - fmt-and-lint: - name: format and lint - runs-on: ubuntu-latest - defaults: - run: - working-directory: ./vscode-cairo - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-node@v3 - with: - node-version: '22.x' - cache: npm - cache-dependency-path: vscode-cairo/package-lock.json - - run: npm ci - - run: npm run lint-fmt - - run: npm run lint-eslint - - run: npm run compile-test - - run: npm run test diff --git a/.gitignore b/.gitignore index 559e4b5..ec4d729 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,5 @@ /out /*.vsix /.vscode/settings.json +/.idea/ +.DS_Store diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 6df3fcf..4c7e2e3 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,8 +1,7 @@ # Contributing to the Cairo extension for Visual Studio Code -This document is a supplement to the [general contributing guidelines](../docs/CONTRIBUTING.md) for -the Cairo repository. -Please read that document first carefully before proceeding with the instructions below. +When contributing to this repository, please first discuss the change you wish to make via issue, +email, or any other method with the owners of this repository before making a change. You might also want to check out the [CairoLS contributing guidelines](../crates/cairo-lang-language-server/CONTRIBUTING.md). @@ -13,8 +12,8 @@ There are three ways you can develop and run the extension. 1. ### Develop and debug from within VS Code - Open the `vscode-cairo` directory in VS Code and press `F5` to start debugging. - Everything should be already set up in the `vscode-cairo/.vscode` directory. + Open this repository in VS Code and press `F5` to start debugging. + Everything should be already set up in the `.vscode` directory. 2. ### Develop in your editor of choice and run in the VS Code Extension Host @@ -23,16 +22,16 @@ There are three ways you can develop and run the extension. ```sh # Build the extension. - $ npm --prefix vscode-cairo run compile + $ npm run compile # Run the extension in the VS Code Extension Host. - $ code "--extensionDevelopmentPath=$PWD/vscode-cairo" --wait --verbose + $ code "--extensionDevelopmentPath=$PWD" --wait --verbose ``` The `--wait --verbose` arguments make the command wait until the Extension Host is closed. You can skip them if you do not want to block your terminal. -3. ### Package the extension manually and install in VS Code +3. ### Package the extension manually and install it in VS Code This technique is useful if you are not interested in developing the extension itself, but you need some unreleased changes when working on the Cairo compiler overall. @@ -44,15 +43,9 @@ There are three ways you can develop and run the extension. $ brew install vsce # Package the extension. - $ cd vscode-cairo $ vsce package # Install the extension in your VS Code installation. # The `` part will vary depending on the HEAD you are working on. $ code --install-extension cairo1-.vsix ``` - -## Commits - -If your commit/pull request is solely related to the VSCode extension, please prefix your commit -message/PR title with `VSCode: `. diff --git a/LICENSE b/LICENSE deleted file mode 120000 index ea5b606..0000000 --- a/LICENSE +++ /dev/null @@ -1 +0,0 @@ -../LICENSE \ No newline at end of file diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..7a4a3ea --- /dev/null +++ b/LICENSE @@ -0,0 +1,202 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. \ No newline at end of file diff --git a/README.md b/README.md index a3a15fb..3aea97c 100644 --- a/README.md +++ b/README.md @@ -56,7 +56,7 @@ If you run into issues with the extension, try these debugging steps: 1. Make sure you have the latest version of the extension installed. 2. Make sure you have the latest version of Scarb installed. 3. Make sure the problem is also not appearing while running `scarb build`. -4. Try the latest nightly release of Scarb, to verify the bug is not fixed yet. +4. Try the latest nightly release of Scarb to verify the bug is not fixed yet. This is simple to do with asdf: ```sh asdf install scarb latest:nightly @@ -87,21 +87,17 @@ If you feel brave enough, you can try some of the more advanced debugging techni ## Submitting bugs/issues -If you have a problem that you think should be fixed, please follow steps below: +If you have a problem that you think should be fixed, please follow the steps below: -1. Submit [a new `bug` issue][cairo-new-bug] -2. Choose [`ide` label][cairo-ide-label] -3. Fill out the issue template -4. Attach all relevant screenshots, logs with trace (obtained with steps in [Troubleshooting]) -5. Do not forget to attach context like: - - Scarb version (which version or which nightly?), or commit reference (if built locally), - - relevant `Cairo` extension VSCode configuration, - - `Cairo` extension version. +1. Submit [a new bug report][new-bug] +2. Fill out the issue template +3. Attach all relevant screenshots, logs with trace (obtained with steps in [Troubleshooting]) +4. Remember to provide as much information as possible. + The issue form will guide you through the process. [cairo]: https://www.cairo-lang.org/ -[cairo-ide-label]: https://github.com/starkware-libs/cairo/labels/ide -[cairo-new-bug]: https://github.com/starkware-libs/cairo/issues/new?assignees=&labels=bug&projects=&template=01_BUG_REPORT.md&title=bug%3A+ -[debugging]: https://github.com/starkware-libs/cairo/blob/main/crates/cairo-lang-language-server/CONTRIBUTING.md#debugging +[new-bug]: https://github.com/software-mansion/vscode-cairo/issues/new?assignees=&labels=bug&projects=&template=bug_report.yml +[debugging]: https://github.com/software-mansion/cairols/blob/main/CONTRIBUTING.md#debugging [discord]: https://discord.gg/QypNMzkHbc [dojo engine]: https://book.dojoengine.org/ [scarb]: https://docs.swmansion.com/scarb diff --git a/SECURITY.md b/SECURITY.md new file mode 100644 index 0000000..e7a6a25 --- /dev/null +++ b/SECURITY.md @@ -0,0 +1,20 @@ +# Security Policy + +## Supported Versions + +Only the latest release is supported with security updates. + +## Reporting a Vulnerability + +If there are any vulnerabilities in **Cairo extension for Visual Studio Code**, don't hesitate to +_report them_. + +1. If you found a vulnerability in **Cairo language/compiler**, please consult its + own [security policy](https://github.com/starkware-libs/cairo/security/policy). +2. If you found a vulnerability in **Cairo Language Server**, please consult its + own [security policy](https://github.com/software-mansion/cairols/security/policy). +3. Use the GitHub Security site for reporting vulnerabilities. You can report + one [here](https://github.com/software-mansion/vscode-cairo/security/advisories/new). +4. Please **do not disclose the vulnerability publicly** until a fix is released! +5. Once we have either a) published a fix or b) declined to address the vulnerability for whatever + reason, you are free to publicly disclose it. diff --git a/SUPPORT.md b/SUPPORT.md deleted file mode 100644 index 0c38c21..0000000 --- a/SUPPORT.md +++ /dev/null @@ -1,16 +0,0 @@ -# Support - -## How to file issues - -This project uses GitHub Issues to track bugs and feature requests. -Please search the [existing issues](https://github.com/starkware-libs/cairo/issues) before filing -new issues to avoid duplicates. -For new issues, file your bug or feature request as a new Issue. -Make sure to mention that your issue concerns language server specifically to get your request -processed quicker. - -## Contact - -If you have searched the GitHub issues for your problem, and still would like to contact the team, -we are providing support on [Telegram](https://t.me/cairo_ls_support) or -[Discord](https://discord.gg/QypNMzkHbc). diff --git a/scripts/vscode-cairo-check-cairo-snippets.sh b/bin/check-cairo-snippets.sh similarity index 84% rename from scripts/vscode-cairo-check-cairo-snippets.sh rename to bin/check-cairo-snippets.sh index 63a0148..ab09f0d 100755 --- a/scripts/vscode-cairo-check-cairo-snippets.sh +++ b/bin/check-cairo-snippets.sh @@ -1,6 +1,6 @@ #!/bin/bash -npm --prefix vscode-cairo run gen-cairo-snippets +npm run gen-cairo-snippets if [[ $(git diff --stat) != '' ]]; then echo 'The corpus of Cairo snippets used in syntax highlighting test in vscode-cairo is out of date.' diff --git a/bin/gen-cairo-snippets.mjs b/bin/gen-cairo-snippets.mjs index 9b9cba4..4f33f7e 100644 --- a/bin/gen-cairo-snippets.mjs +++ b/bin/gen-cairo-snippets.mjs @@ -5,7 +5,9 @@ */ import assert from "assert/strict"; +import * as child_process from "node:child_process"; import fs from "node:fs/promises"; +import os from "node:os"; import path from "node:path"; import { fileURLToPath } from "node:url"; import { format } from "prettier"; @@ -18,14 +20,22 @@ const runners = { test_partial_parser_tree_with_trivia: cairoCodeTestRunner, }; -const cairoLangParserRoot = path.join( - fileURLToPath(import.meta.url), - "..", - "..", - "..", - "crates", - "cairo-lang-parser", -); +const cairoCheckout = await fs.mkdtemp(path.join(os.tmpdir(), "cairo-")); + +await new Promise((resolve, reject) => { + const proc = child_process.spawn( + "git", + ["clone", "https://github.com/starkware-libs/cairo.git", cairoCheckout], + { + stdio: "inherit", + }, + ); + + proc.on("error", reject); + proc.on("close", resolve); +}); + +const cairoLangParserRoot = path.join(cairoCheckout, "crates", "cairo-lang-parser"); const parserTestDataRoot = path.join(cairoLangParserRoot, "src", "parser_test_data"); assert.ok((await fs.stat(parserTestDataRoot)).isDirectory()); diff --git a/package.json b/package.json index b022b4f..1073cc8 100644 --- a/package.json +++ b/package.json @@ -18,7 +18,7 @@ ], "repository": { "type": "git", - "url": "https://github.com/starkware-libs/cairo.git" + "url": "https://github.com/software-mansion/vscode-cairo.git" }, "license": "Apache-2.0", "icon": "icons/marketplace.png", diff --git a/test-support/cairo-snippets.gen.mjs b/test-support/cairo-snippets.gen.mjs index 438fdde..f95bc3e 100644 --- a/test-support/cairo-snippets.gen.mjs +++ b/test-support/cairo-snippets.gen.mjs @@ -12,6 +12,7 @@ export default [ "#[derive(Copy, Drop)]\nenum bool {\n False: (),\n True: (),\n}\n\n#[empty_attr()]\nmod empty {}\n\n#[derive(Copy, Drop, PartialEq, Serde)]\nstruct u256 {\n low: u128,\n}\n\n#[post('/', data: '')]\nfn string_value() {}\n\n#[cfg(attr(value: C))]\nfn const_value() {}\n\n#[cfg_attr(test, assert_instr(instr: add_a.b))]\nfn custom_name() {}\n\n#[attr(foo::bar, qwe)]\nfn arbitrary_token_tree() {}", "#[extern]\n#[abc]\nfn missing_id (ref: Ref::) { }", "#[mod]\nfn foo() {}", + "// Regular comment\n//! Inner documentation comment\n/// Documentation comment\nfn foo() {}", "// TODO(Gil): handle multiline diagnostics.\n#[bbb]\nmacro", "/// TODO(Tomerstarkware): parse logical operators with lower precedence than `=`\nfn f() {\n if let Some(x) = 2 && false {\n 3\n }\n}", ";\n#[attr]\nfn foo(var1: int var2: felt252) -> int {\n let bla = 7 + true + 'abc'; // comment\n return bar(bla);\n}\n", @@ -19,7 +20,7 @@ export default [ "const X: NonZero:: = 0x1234;", "const X: [felt252; 3] = [1, 2, 3];", "enum MyEnum {\n A(felt252),\n}", - "enum MyEnum {\n A: felt252,\n B: felt252,\n MissingComma\n}", + "enum MyEnum {\n A: felt252,\n B: felt252,\n MissingComma,\n}", "enum _ {}", "enum mod {}", "extern fn _() nopanic;", @@ -27,9 +28,13 @@ export default [ "extern type _;", "extern type mod;", "fn _() {}", + "fn bar() {}\n// Regular comment\n/// Documentation comment\n//! Inner documentation comment\nfn foo() {}", + "fn bar() {}\n/// Documentation comment\n// Regular comment\n//! Inner documentation comment\nfn foo() {}", "fn emit, -traits::Into>(ref self: T, event: S) {}", + "fn f() -> bool {\n 3 < 1 > 5\n}", "fn f() -> u32 {\n -3 * 5\n}", "fn f() -> u32 {\n -a * 5\n}", + "fn f() {\n for i in 1..x {}\n}", "fn f() {\n if 0 == if x {1} else {2} {\n }\n}", "fn f() {\n if 1 == 2 {\n 3\n } else if 4 == 5 {\n 6\n } else if 7 == 8 {\n 9\n } else {\n 10\n }\n}", "fn f() {\n if MyStruct{a: 0} == MyStruct{a: 1} {\n }\n}", @@ -55,7 +60,8 @@ export default [ "fn f() {\n match MyStruct{a: 1} {\n }\n match x {\n 1 => {},\n Struct{a, b: _, .., a: A::Variant(4)} => {},\n x => {},\n bool::False() => {}\n }\n}", "fn f() {\n while let Some(x) = 2 {\n break 5;\n }\n}", "fn f() {\n while true {\n 1;\n }\n}", - "fn f() {\n {\n 5\n } + match x {\n E::V1(_) => 4,\n E::V2(_) => 2\n } - if cond {\n 32\n } else {\n 1\n }\n}", + "fn f() {\n x += false && true..1 + 2\n}", + "fn f() {\n {\n 5\n } + match x {\n E::V1(_) => 4,\n E::V2(_) => 2,\n } - if cond {\n 32\n } else {\n 1\n }\n}", "fn f() {\n {4} - 1 + / 2 + {5}\n}", 'fn f() {\n let unterminated_str = "abc;\n}', "fn f() {\n let unterminated_str = 'abc;\n}", @@ -64,7 +70,7 @@ export default [ "fn f(mod: felt252) {}", "fn f(ref _: felt252) {}", "fn f(ref mod: felt252) {}", - "fn f(x: felt252,) {\n let x = 5;\n match x {\n 0 | 1 => 1,\n _ => 2,\n };\n}", + "fn f(x: felt252) {\n let x = 5;\n match x {\n 0 | 1 => 1,\n _ => 2,\n };\n}", "fn foo (x:T) -> S\n{\n let x = -5 + 3;\n let y : T = x*2 + 3*5; // Comment.\n let z = ;\n let v = bool::True == false;\n 5 + Struct{a: 5, b: Struct2{_gg: ()}};\n return df == 6;\n x + y\n}\n\npub impl A of B {\n fn foo() {\n if bla.\n // The module below should parse correctly, not inside this impl.\n }\n}\n\npub mod my_mod{\n fn bar (x:T0, s: S) -> X {\n x.a *+-. s.s * foo(1,3)\n }\n struct A{\n x: a, // Comment.\n y: int\n }\n\n}\n\nskipped tokens\n", "fn foo() -> Aaaaa Bbb + Cc {\n}", "fn foo() -> Aaaaa Bbb + Cc; let x = 0; }", @@ -76,13 +82,18 @@ export default [ "fn foo() {\n #[aaa]\n let x = 1;\n #[bbb]\n}", "fn foo() {\n #[aaa]\n}", "fn foo() {\n #[an_attribute]\n let x = 1;\n}", + "fn foo() {\n #[attribute]\n type R = u8;\n}", + "fn foo() {\n #[attribute]\n use X::*;\n}", + "fn foo() {\n #[attribute]\n use X::Y;\n}", "fn foo() {\n #[bbb]\n // A comment\n}", + "fn foo() {\n #[flat]\n const X: felt252 = 3;\n}", "fn foo() {\n $\n #[aaa]\n}", "fn foo() {\n // A comment\n #[bbb]\n}", "fn foo() {\n A { _ }\n}", "fn foo() {\n A { mod }\n}", "fn foo() {\n bar::();\n}", "fn foo() {\n bar::();\n}", + "fn foo() {\n const X = 3;\n}", "fn foo() {\n let MyStruct { _ } = 3;\n}", "fn foo() {\n let MyStruct { mod } = 3;\n}", 'fn foo() {\n let a = "\\u{1024}";\n}', @@ -94,6 +105,10 @@ export default [ "fn foo() {\n let ref _ = 3;\n}", "fn foo() {\n let ref mod = 3;\n}", "fn foo() {\n let x += 5;\n}", + "fn foo() {\n type R = u8;\n}", + "fn foo() {\n use X::*;\n}", + "fn foo() {\n use X::Y;\n}", + "fn foo() {\n use X::{A, *, B};\n}", "fn foo() {}\nskipped tokens\nfn bar() {}", "fn foo(a: Option::) {}", "fn foo(a: Option) {}", @@ -157,6 +172,7 @@ export default [ "skipped tokens", "struct A {\n _: felt252\n}", "struct A {\n a: felt252,\n}\nfn f(x: (A, felt252)) {\n let (A { a: mut a }, ref mut b) = x;\n}", + "struct A {\n member: felt252,\n}\n\nfn foo() {\n const X: felt252 = 3;\n const Y: A = A { member: 3 };\n}", "struct A {\n mod: felt252\n}", "struct A<_> {}", "struct A {}", diff --git a/test/snapshots/03c478259d.txt b/test/snapshots/03c478259d.txt new file mode 100644 index 0000000..0d5d014 --- /dev/null +++ b/test/snapshots/03c478259d.txt @@ -0,0 +1,23 @@ +//! > cairo_code +fn f() { + x += false && true..1 + 2 +} + +//! > syntax +fn source.cairo meta.function.definition.cairo keyword.other.fn.cairo +␣ source.cairo meta.function.definition.cairo +f source.cairo meta.function.definition.cairo entity.name.function.cairo +( source.cairo meta.function.definition.cairo punctuation.brackets.round.cairo +) source.cairo meta.function.definition.cairo punctuation.brackets.round.cairo +␣ source.cairo meta.function.definition.cairo +{ source.cairo meta.function.definition.cairo punctuation.brackets.curly.cairo +x source.cairo variable.other.cairo ++= source.cairo keyword.operator.assignment.cairo +false source.cairo constant.language.bool.cairo +&& source.cairo keyword.operator.logical.cairo +true source.cairo constant.language.bool.cairo +.. source.cairo keyword.operator.range.cairo +1 source.cairo constant.numeric.decimal.cairo ++ source.cairo keyword.operator.math.cairo +2 source.cairo constant.numeric.decimal.cairo +} source.cairo punctuation.brackets.curly.cairo diff --git a/test/snapshots/07f81ae322.txt b/test/snapshots/07f81ae322.txt new file mode 100644 index 0000000..55e5971 --- /dev/null +++ b/test/snapshots/07f81ae322.txt @@ -0,0 +1,20 @@ +//! > cairo_code +fn foo() { + use X::*; +} + +//! > syntax +fn source.cairo meta.function.definition.cairo keyword.other.fn.cairo +␣ source.cairo meta.function.definition.cairo +foo source.cairo meta.function.definition.cairo entity.name.function.cairo +( source.cairo meta.function.definition.cairo punctuation.brackets.round.cairo +) source.cairo meta.function.definition.cairo punctuation.brackets.round.cairo +␣ source.cairo meta.function.definition.cairo +{ source.cairo meta.function.definition.cairo punctuation.brackets.curly.cairo +use source.cairo meta.use.cairo keyword.other.cairo +␣ source.cairo meta.use.cairo +X source.cairo meta.use.cairo entity.name.namespace.cairo +:: source.cairo meta.use.cairo keyword.operator.namespace.cairo +* source.cairo meta.use.cairo keyword.operator.math.cairo +; source.cairo meta.use.cairo punctuation.semi.cairo +} source.cairo punctuation.brackets.curly.cairo diff --git a/test/snapshots/1d0fb4cb72.txt b/test/snapshots/1d0fb4cb72.txt new file mode 100644 index 0000000..ee23eda --- /dev/null +++ b/test/snapshots/1d0fb4cb72.txt @@ -0,0 +1,23 @@ +//! > cairo_code +fn f() -> bool { + 3 < 1 > 5 +} + +//! > syntax +fn source.cairo meta.function.definition.cairo keyword.other.fn.cairo +␣ source.cairo meta.function.definition.cairo +f source.cairo meta.function.definition.cairo entity.name.function.cairo +( source.cairo meta.function.definition.cairo punctuation.brackets.round.cairo +) source.cairo meta.function.definition.cairo punctuation.brackets.round.cairo +␣ source.cairo meta.function.definition.cairo +-> source.cairo meta.function.definition.cairo keyword.operator.arrow.skinny.cairo +␣ source.cairo meta.function.definition.cairo +bool source.cairo meta.function.definition.cairo entity.name.type.primitive.cairo +␣ source.cairo meta.function.definition.cairo +{ source.cairo meta.function.definition.cairo punctuation.brackets.curly.cairo +3 source.cairo constant.numeric.decimal.cairo +< source.cairo keyword.operator.comparison.cairo +1 source.cairo constant.numeric.decimal.cairo +> source.cairo keyword.operator.comparison.cairo +5 source.cairo constant.numeric.decimal.cairo +} source.cairo punctuation.brackets.curly.cairo diff --git a/test/snapshots/216e611c2c.txt b/test/snapshots/216e611c2c.txt new file mode 100644 index 0000000..ca9dd34 --- /dev/null +++ b/test/snapshots/216e611c2c.txt @@ -0,0 +1,25 @@ +//! > cairo_code +fn foo() { + #[attribute] + use X::Y; +} + +//! > syntax +fn source.cairo meta.function.definition.cairo keyword.other.fn.cairo +␣ source.cairo meta.function.definition.cairo +foo source.cairo meta.function.definition.cairo entity.name.function.cairo +( source.cairo meta.function.definition.cairo punctuation.brackets.round.cairo +) source.cairo meta.function.definition.cairo punctuation.brackets.round.cairo +␣ source.cairo meta.function.definition.cairo +{ source.cairo meta.function.definition.cairo punctuation.brackets.curly.cairo +# source.cairo meta.attribute.cairo punctuation.definition.attribute.cairo +[ source.cairo meta.attribute.cairo punctuation.brackets.attribute.cairo +attribute source.cairo meta.attribute.cairo +] source.cairo meta.attribute.cairo punctuation.brackets.attribute.cairo +use source.cairo meta.use.cairo keyword.other.cairo +␣ source.cairo meta.use.cairo +X source.cairo meta.use.cairo entity.name.namespace.cairo +:: source.cairo meta.use.cairo keyword.operator.namespace.cairo +Y source.cairo meta.use.cairo entity.name.type.cairo +; source.cairo meta.use.cairo punctuation.semi.cairo +} source.cairo punctuation.brackets.curly.cairo diff --git a/test/snapshots/46af71b748.txt b/test/snapshots/46af71b748.txt new file mode 100644 index 0000000..69c18d1 --- /dev/null +++ b/test/snapshots/46af71b748.txt @@ -0,0 +1,25 @@ +//! > cairo_code +fn foo() { + #[attribute] + use X::*; +} + +//! > syntax +fn source.cairo meta.function.definition.cairo keyword.other.fn.cairo +␣ source.cairo meta.function.definition.cairo +foo source.cairo meta.function.definition.cairo entity.name.function.cairo +( source.cairo meta.function.definition.cairo punctuation.brackets.round.cairo +) source.cairo meta.function.definition.cairo punctuation.brackets.round.cairo +␣ source.cairo meta.function.definition.cairo +{ source.cairo meta.function.definition.cairo punctuation.brackets.curly.cairo +# source.cairo meta.attribute.cairo punctuation.definition.attribute.cairo +[ source.cairo meta.attribute.cairo punctuation.brackets.attribute.cairo +attribute source.cairo meta.attribute.cairo +] source.cairo meta.attribute.cairo punctuation.brackets.attribute.cairo +use source.cairo meta.use.cairo keyword.other.cairo +␣ source.cairo meta.use.cairo +X source.cairo meta.use.cairo entity.name.namespace.cairo +:: source.cairo meta.use.cairo keyword.operator.namespace.cairo +* source.cairo meta.use.cairo keyword.operator.math.cairo +; source.cairo meta.use.cairo punctuation.semi.cairo +} source.cairo punctuation.brackets.curly.cairo diff --git a/test/snapshots/4857646105.txt b/test/snapshots/4857646105.txt new file mode 100644 index 0000000..743aff7 --- /dev/null +++ b/test/snapshots/4857646105.txt @@ -0,0 +1,20 @@ +//! > cairo_code +fn foo() { + use X::Y; +} + +//! > syntax +fn source.cairo meta.function.definition.cairo keyword.other.fn.cairo +␣ source.cairo meta.function.definition.cairo +foo source.cairo meta.function.definition.cairo entity.name.function.cairo +( source.cairo meta.function.definition.cairo punctuation.brackets.round.cairo +) source.cairo meta.function.definition.cairo punctuation.brackets.round.cairo +␣ source.cairo meta.function.definition.cairo +{ source.cairo meta.function.definition.cairo punctuation.brackets.curly.cairo +use source.cairo meta.use.cairo keyword.other.cairo +␣ source.cairo meta.use.cairo +X source.cairo meta.use.cairo entity.name.namespace.cairo +:: source.cairo meta.use.cairo keyword.operator.namespace.cairo +Y source.cairo meta.use.cairo entity.name.type.cairo +; source.cairo meta.use.cairo punctuation.semi.cairo +} source.cairo punctuation.brackets.curly.cairo diff --git a/test/snapshots/54b11ce428.txt b/test/snapshots/54b11ce428.txt new file mode 100644 index 0000000..6e14410 --- /dev/null +++ b/test/snapshots/54b11ce428.txt @@ -0,0 +1,22 @@ +//! > cairo_code +enum MyEnum { + A: felt252, + B: felt252, + MissingComma, +} + +//! > syntax +enum source.cairo keyword.declaration.enum.cairo storage.type.cairo +MyEnum source.cairo entity.name.type.enum.cairo +{ source.cairo punctuation.brackets.curly.cairo +A source.cairo entity.name.type.cairo +: source.cairo keyword.operator.key-value.cairo +felt252 source.cairo entity.name.type.numeric.cairo +, source.cairo punctuation.comma.cairo +B source.cairo entity.name.type.cairo +: source.cairo keyword.operator.key-value.cairo +felt252 source.cairo entity.name.type.numeric.cairo +, source.cairo punctuation.comma.cairo +MissingComma source.cairo entity.name.type.cairo +, source.cairo punctuation.comma.cairo +} source.cairo punctuation.brackets.curly.cairo diff --git a/test/snapshots/90a1b3e79b.txt b/test/snapshots/90a1b3e79b.txt new file mode 100644 index 0000000..df1c132 --- /dev/null +++ b/test/snapshots/90a1b3e79b.txt @@ -0,0 +1,26 @@ +//! > cairo_code +fn foo() { + #[flat] + const X: felt252 = 3; +} + +//! > syntax +fn source.cairo meta.function.definition.cairo keyword.other.fn.cairo +␣ source.cairo meta.function.definition.cairo +foo source.cairo meta.function.definition.cairo entity.name.function.cairo +( source.cairo meta.function.definition.cairo punctuation.brackets.round.cairo +) source.cairo meta.function.definition.cairo punctuation.brackets.round.cairo +␣ source.cairo meta.function.definition.cairo +{ source.cairo meta.function.definition.cairo punctuation.brackets.curly.cairo +# source.cairo meta.attribute.cairo punctuation.definition.attribute.cairo +[ source.cairo meta.attribute.cairo punctuation.brackets.attribute.cairo +flat source.cairo meta.attribute.cairo +] source.cairo meta.attribute.cairo punctuation.brackets.attribute.cairo +const source.cairo storage.type.cairo +X source.cairo constant.other.caps.cairo +: source.cairo keyword.operator.key-value.cairo +felt252 source.cairo entity.name.type.numeric.cairo += source.cairo keyword.operator.assignment.equal.cairo +3 source.cairo constant.numeric.decimal.cairo +; source.cairo punctuation.semi.cairo +} source.cairo punctuation.brackets.curly.cairo diff --git a/test/snapshots/989ce82952.txt b/test/snapshots/989ce82952.txt new file mode 100644 index 0000000..96dabd4 --- /dev/null +++ b/test/snapshots/989ce82952.txt @@ -0,0 +1,28 @@ +//! > cairo_code +fn foo() { + use X::{A, *, B}; +} + +//! > syntax +fn source.cairo meta.function.definition.cairo keyword.other.fn.cairo +␣ source.cairo meta.function.definition.cairo +foo source.cairo meta.function.definition.cairo entity.name.function.cairo +( source.cairo meta.function.definition.cairo punctuation.brackets.round.cairo +) source.cairo meta.function.definition.cairo punctuation.brackets.round.cairo +␣ source.cairo meta.function.definition.cairo +{ source.cairo meta.function.definition.cairo punctuation.brackets.curly.cairo +use source.cairo meta.use.cairo keyword.other.cairo +␣ source.cairo meta.use.cairo +X source.cairo meta.use.cairo entity.name.namespace.cairo +:: source.cairo meta.use.cairo keyword.operator.namespace.cairo +{ source.cairo meta.use.cairo punctuation.brackets.curly.cairo +A source.cairo meta.use.cairo entity.name.type.cairo +, source.cairo meta.use.cairo punctuation.comma.cairo +␣ source.cairo meta.use.cairo +* source.cairo meta.use.cairo keyword.operator.math.cairo +, source.cairo meta.use.cairo punctuation.comma.cairo +␣ source.cairo meta.use.cairo +B source.cairo meta.use.cairo entity.name.type.cairo +} source.cairo meta.use.cairo punctuation.brackets.curly.cairo +; source.cairo meta.use.cairo punctuation.semi.cairo +} source.cairo punctuation.brackets.curly.cairo diff --git a/test/snapshots/a8222035a3.txt b/test/snapshots/a8222035a3.txt new file mode 100644 index 0000000..f0ad5d3 --- /dev/null +++ b/test/snapshots/a8222035a3.txt @@ -0,0 +1,46 @@ +//! > cairo_code +struct A { + member: felt252, +} + +fn foo() { + const X: felt252 = 3; + const Y: A = A { member: 3 }; +} + +//! > syntax +struct source.cairo keyword.declaration.struct.cairo storage.type.cairo +A source.cairo entity.name.type.struct.cairo +{ source.cairo punctuation.brackets.curly.cairo +member source.cairo variable.other.cairo +: source.cairo keyword.operator.key-value.cairo +felt252 source.cairo entity.name.type.numeric.cairo +, source.cairo punctuation.comma.cairo +} source.cairo punctuation.brackets.curly.cairo +fn source.cairo meta.function.definition.cairo keyword.other.fn.cairo +␣ source.cairo meta.function.definition.cairo +foo source.cairo meta.function.definition.cairo entity.name.function.cairo +( source.cairo meta.function.definition.cairo punctuation.brackets.round.cairo +) source.cairo meta.function.definition.cairo punctuation.brackets.round.cairo +␣ source.cairo meta.function.definition.cairo +{ source.cairo meta.function.definition.cairo punctuation.brackets.curly.cairo +const source.cairo storage.type.cairo +X source.cairo constant.other.caps.cairo +: source.cairo keyword.operator.key-value.cairo +felt252 source.cairo entity.name.type.numeric.cairo += source.cairo keyword.operator.assignment.equal.cairo +3 source.cairo constant.numeric.decimal.cairo +; source.cairo punctuation.semi.cairo +const source.cairo storage.type.cairo +Y source.cairo constant.other.caps.cairo +: source.cairo keyword.operator.key-value.cairo +A source.cairo entity.name.type.cairo += source.cairo keyword.operator.assignment.equal.cairo +A source.cairo entity.name.type.cairo +{ source.cairo punctuation.brackets.curly.cairo +member source.cairo variable.other.cairo +: source.cairo keyword.operator.key-value.cairo +3 source.cairo constant.numeric.decimal.cairo +} source.cairo punctuation.brackets.curly.cairo +; source.cairo punctuation.semi.cairo +} source.cairo punctuation.brackets.curly.cairo diff --git a/test/snapshots/b8fbad0b3e.txt b/test/snapshots/b8fbad0b3e.txt new file mode 100644 index 0000000..d8a1af4 --- /dev/null +++ b/test/snapshots/b8fbad0b3e.txt @@ -0,0 +1,24 @@ +//! > cairo_code +fn foo() { + #[attribute] + type R = u8; +} + +//! > syntax +fn source.cairo meta.function.definition.cairo keyword.other.fn.cairo +␣ source.cairo meta.function.definition.cairo +foo source.cairo meta.function.definition.cairo entity.name.function.cairo +( source.cairo meta.function.definition.cairo punctuation.brackets.round.cairo +) source.cairo meta.function.definition.cairo punctuation.brackets.round.cairo +␣ source.cairo meta.function.definition.cairo +{ source.cairo meta.function.definition.cairo punctuation.brackets.curly.cairo +# source.cairo meta.attribute.cairo punctuation.definition.attribute.cairo +[ source.cairo meta.attribute.cairo punctuation.brackets.attribute.cairo +attribute source.cairo meta.attribute.cairo +] source.cairo meta.attribute.cairo punctuation.brackets.attribute.cairo +type source.cairo keyword.declaration.type.cairo storage.type.cairo +R source.cairo entity.name.type.declaration.cairo += source.cairo keyword.operator.assignment.equal.cairo +u8 source.cairo entity.name.type.numeric.cairo +; source.cairo punctuation.semi.cairo +} source.cairo punctuation.brackets.curly.cairo diff --git a/test/snapshots/bff0ed748f.txt b/test/snapshots/bff0ed748f.txt new file mode 100644 index 0000000..c4d1c71 --- /dev/null +++ b/test/snapshots/bff0ed748f.txt @@ -0,0 +1,30 @@ +//! > cairo_code +fn bar() {} +/// Documentation comment +// Regular comment +//! Inner documentation comment +fn foo() {} + +//! > syntax +fn source.cairo meta.function.definition.cairo keyword.other.fn.cairo +␣ source.cairo meta.function.definition.cairo +bar source.cairo meta.function.definition.cairo entity.name.function.cairo +( source.cairo meta.function.definition.cairo punctuation.brackets.round.cairo +) source.cairo meta.function.definition.cairo punctuation.brackets.round.cairo +␣ source.cairo meta.function.definition.cairo +{ source.cairo meta.function.definition.cairo punctuation.brackets.curly.cairo +} source.cairo punctuation.brackets.curly.cairo +/// source.cairo comment.line.documentation.cairo punctuation.definition.comment.cairo +␣Documentation␣comment source.cairo comment.line.documentation.cairo +// source.cairo comment.line.double-slash.cairo punctuation.definition.comment.cairo +␣Regular␣comment source.cairo comment.line.double-slash.cairo +// source.cairo comment.line.double-slash.cairo punctuation.definition.comment.cairo +!␣Inner␣documentation␣comment source.cairo comment.line.double-slash.cairo +fn source.cairo meta.function.definition.cairo keyword.other.fn.cairo +␣ source.cairo meta.function.definition.cairo +foo source.cairo meta.function.definition.cairo entity.name.function.cairo +( source.cairo meta.function.definition.cairo punctuation.brackets.round.cairo +) source.cairo meta.function.definition.cairo punctuation.brackets.round.cairo +␣ source.cairo meta.function.definition.cairo +{ source.cairo meta.function.definition.cairo punctuation.brackets.curly.cairo +} source.cairo punctuation.brackets.curly.cairo diff --git a/test/snapshots/c02e027d0d.txt b/test/snapshots/c02e027d0d.txt new file mode 100644 index 0000000..eb2fc88 --- /dev/null +++ b/test/snapshots/c02e027d0d.txt @@ -0,0 +1,59 @@ +//! > cairo_code +fn f() { + { + 5 + } + match x { + E::V1(_) => 4, + E::V2(_) => 2, + } - if cond { + 32 + } else { + 1 + } +} + +//! > syntax +fn source.cairo meta.function.definition.cairo keyword.other.fn.cairo +␣ source.cairo meta.function.definition.cairo +f source.cairo meta.function.definition.cairo entity.name.function.cairo +( source.cairo meta.function.definition.cairo punctuation.brackets.round.cairo +) source.cairo meta.function.definition.cairo punctuation.brackets.round.cairo +␣ source.cairo meta.function.definition.cairo +{ source.cairo meta.function.definition.cairo punctuation.brackets.curly.cairo +{ source.cairo punctuation.brackets.curly.cairo +5 source.cairo constant.numeric.decimal.cairo +} source.cairo punctuation.brackets.curly.cairo ++ source.cairo keyword.operator.math.cairo +match source.cairo keyword.control.cairo +x source.cairo variable.other.cairo +{ source.cairo punctuation.brackets.curly.cairo +E source.cairo entity.name.type.cairo +:: source.cairo keyword.operator.namespace.cairo +V1 source.cairo meta.function.call.cairo entity.name.function.cairo +( source.cairo meta.function.call.cairo punctuation.brackets.round.cairo +_ source.cairo meta.function.call.cairo variable.other.cairo +) source.cairo meta.function.call.cairo punctuation.brackets.round.cairo +=> source.cairo keyword.operator.arrow.fat.cairo +4 source.cairo constant.numeric.decimal.cairo +, source.cairo punctuation.comma.cairo +E source.cairo entity.name.type.cairo +:: source.cairo keyword.operator.namespace.cairo +V2 source.cairo meta.function.call.cairo entity.name.function.cairo +( source.cairo meta.function.call.cairo punctuation.brackets.round.cairo +_ source.cairo meta.function.call.cairo variable.other.cairo +) source.cairo meta.function.call.cairo punctuation.brackets.round.cairo +=> source.cairo keyword.operator.arrow.fat.cairo +2 source.cairo constant.numeric.decimal.cairo +, source.cairo punctuation.comma.cairo +} source.cairo punctuation.brackets.curly.cairo +- source.cairo keyword.operator.math.cairo +if source.cairo keyword.control.cairo +cond source.cairo variable.other.cairo +{ source.cairo punctuation.brackets.curly.cairo +32 source.cairo constant.numeric.decimal.cairo +} source.cairo punctuation.brackets.curly.cairo +else source.cairo keyword.control.cairo +{ source.cairo punctuation.brackets.curly.cairo +1 source.cairo constant.numeric.decimal.cairo +} source.cairo punctuation.brackets.curly.cairo +} source.cairo punctuation.brackets.curly.cairo diff --git a/test/snapshots/c6d9afabc3.txt b/test/snapshots/c6d9afabc3.txt new file mode 100644 index 0000000..b4a3025 --- /dev/null +++ b/test/snapshots/c6d9afabc3.txt @@ -0,0 +1,19 @@ +//! > cairo_code +fn foo() { + const X = 3; +} + +//! > syntax +fn source.cairo meta.function.definition.cairo keyword.other.fn.cairo +␣ source.cairo meta.function.definition.cairo +foo source.cairo meta.function.definition.cairo entity.name.function.cairo +( source.cairo meta.function.definition.cairo punctuation.brackets.round.cairo +) source.cairo meta.function.definition.cairo punctuation.brackets.round.cairo +␣ source.cairo meta.function.definition.cairo +{ source.cairo meta.function.definition.cairo punctuation.brackets.curly.cairo +const source.cairo storage.type.cairo +X source.cairo constant.other.caps.cairo += source.cairo keyword.operator.assignment.equal.cairo +3 source.cairo constant.numeric.decimal.cairo +; source.cairo punctuation.semi.cairo +} source.cairo punctuation.brackets.curly.cairo diff --git a/test/snapshots/cc1ab622d1.txt b/test/snapshots/cc1ab622d1.txt new file mode 100644 index 0000000..1919367 --- /dev/null +++ b/test/snapshots/cc1ab622d1.txt @@ -0,0 +1,22 @@ +//! > cairo_code +fn f() { + for i in 1..x {} +} + +//! > syntax +fn source.cairo meta.function.definition.cairo keyword.other.fn.cairo +␣ source.cairo meta.function.definition.cairo +f source.cairo meta.function.definition.cairo entity.name.function.cairo +( source.cairo meta.function.definition.cairo punctuation.brackets.round.cairo +) source.cairo meta.function.definition.cairo punctuation.brackets.round.cairo +␣ source.cairo meta.function.definition.cairo +{ source.cairo meta.function.definition.cairo punctuation.brackets.curly.cairo +for source.cairo keyword.control.cairo +i source.cairo variable.other.cairo +in source.cairo keyword.other.cairo +1 source.cairo constant.numeric.decimal.cairo +.. source.cairo keyword.operator.range.cairo +x source.cairo variable.other.cairo +{ source.cairo punctuation.brackets.curly.cairo +} source.cairo punctuation.brackets.curly.cairo +} source.cairo punctuation.brackets.curly.cairo diff --git a/test/snapshots/d2cc7ec731.txt b/test/snapshots/d2cc7ec731.txt new file mode 100644 index 0000000..b763f94 --- /dev/null +++ b/test/snapshots/d2cc7ec731.txt @@ -0,0 +1,21 @@ +//! > cairo_code +// Regular comment +//! Inner documentation comment +/// Documentation comment +fn foo() {} + +//! > syntax +// source.cairo comment.line.double-slash.cairo punctuation.definition.comment.cairo +␣Regular␣comment source.cairo comment.line.double-slash.cairo +// source.cairo comment.line.double-slash.cairo punctuation.definition.comment.cairo +!␣Inner␣documentation␣comment source.cairo comment.line.double-slash.cairo +/// source.cairo comment.line.documentation.cairo punctuation.definition.comment.cairo +␣Documentation␣comment source.cairo comment.line.documentation.cairo +fn source.cairo meta.function.definition.cairo keyword.other.fn.cairo +␣ source.cairo meta.function.definition.cairo +foo source.cairo meta.function.definition.cairo entity.name.function.cairo +( source.cairo meta.function.definition.cairo punctuation.brackets.round.cairo +) source.cairo meta.function.definition.cairo punctuation.brackets.round.cairo +␣ source.cairo meta.function.definition.cairo +{ source.cairo meta.function.definition.cairo punctuation.brackets.curly.cairo +} source.cairo punctuation.brackets.curly.cairo diff --git a/test/snapshots/f5463ef6ab.txt b/test/snapshots/f5463ef6ab.txt new file mode 100644 index 0000000..aa60b40 --- /dev/null +++ b/test/snapshots/f5463ef6ab.txt @@ -0,0 +1,42 @@ +//! > cairo_code +fn f(x: felt252) { + let x = 5; + match x { + 0 | 1 => 1, + _ => 2, + }; +} + +//! > syntax +fn source.cairo meta.function.definition.cairo keyword.other.fn.cairo +␣ source.cairo meta.function.definition.cairo +f source.cairo meta.function.definition.cairo entity.name.function.cairo +( source.cairo meta.function.definition.cairo punctuation.brackets.round.cairo +x source.cairo meta.function.definition.cairo variable.other.cairo +: source.cairo meta.function.definition.cairo keyword.operator.key-value.cairo +␣ source.cairo meta.function.definition.cairo +felt252 source.cairo meta.function.definition.cairo entity.name.type.numeric.cairo +) source.cairo meta.function.definition.cairo punctuation.brackets.round.cairo +␣ source.cairo meta.function.definition.cairo +{ source.cairo meta.function.definition.cairo punctuation.brackets.curly.cairo +let source.cairo keyword.other.cairo storage.type.cairo +x source.cairo variable.other.cairo += source.cairo keyword.operator.assignment.equal.cairo +5 source.cairo constant.numeric.decimal.cairo +; source.cairo punctuation.semi.cairo +match source.cairo keyword.control.cairo +x source.cairo variable.other.cairo +{ source.cairo punctuation.brackets.curly.cairo +0 source.cairo constant.numeric.decimal.cairo +| source.cairo keyword.operator.logical.cairo +1 source.cairo constant.numeric.decimal.cairo +=> source.cairo keyword.operator.arrow.fat.cairo +1 source.cairo constant.numeric.decimal.cairo +, source.cairo punctuation.comma.cairo +_ source.cairo variable.other.cairo +=> source.cairo keyword.operator.arrow.fat.cairo +2 source.cairo constant.numeric.decimal.cairo +, source.cairo punctuation.comma.cairo +} source.cairo punctuation.brackets.curly.cairo +; source.cairo punctuation.semi.cairo +} source.cairo punctuation.brackets.curly.cairo diff --git a/test/snapshots/f5af4c7685.txt b/test/snapshots/f5af4c7685.txt new file mode 100644 index 0000000..c132940 --- /dev/null +++ b/test/snapshots/f5af4c7685.txt @@ -0,0 +1,30 @@ +//! > cairo_code +fn bar() {} +// Regular comment +/// Documentation comment +//! Inner documentation comment +fn foo() {} + +//! > syntax +fn source.cairo meta.function.definition.cairo keyword.other.fn.cairo +␣ source.cairo meta.function.definition.cairo +bar source.cairo meta.function.definition.cairo entity.name.function.cairo +( source.cairo meta.function.definition.cairo punctuation.brackets.round.cairo +) source.cairo meta.function.definition.cairo punctuation.brackets.round.cairo +␣ source.cairo meta.function.definition.cairo +{ source.cairo meta.function.definition.cairo punctuation.brackets.curly.cairo +} source.cairo punctuation.brackets.curly.cairo +// source.cairo comment.line.double-slash.cairo punctuation.definition.comment.cairo +␣Regular␣comment source.cairo comment.line.double-slash.cairo +/// source.cairo comment.line.documentation.cairo punctuation.definition.comment.cairo +␣Documentation␣comment source.cairo comment.line.documentation.cairo +// source.cairo comment.line.double-slash.cairo punctuation.definition.comment.cairo +!␣Inner␣documentation␣comment source.cairo comment.line.double-slash.cairo +fn source.cairo meta.function.definition.cairo keyword.other.fn.cairo +␣ source.cairo meta.function.definition.cairo +foo source.cairo meta.function.definition.cairo entity.name.function.cairo +( source.cairo meta.function.definition.cairo punctuation.brackets.round.cairo +) source.cairo meta.function.definition.cairo punctuation.brackets.round.cairo +␣ source.cairo meta.function.definition.cairo +{ source.cairo meta.function.definition.cairo punctuation.brackets.curly.cairo +} source.cairo punctuation.brackets.curly.cairo diff --git a/test/snapshots/fa4246efcc.txt b/test/snapshots/fa4246efcc.txt new file mode 100644 index 0000000..fef5067 --- /dev/null +++ b/test/snapshots/fa4246efcc.txt @@ -0,0 +1,19 @@ +//! > cairo_code +fn foo() { + type R = u8; +} + +//! > syntax +fn source.cairo meta.function.definition.cairo keyword.other.fn.cairo +␣ source.cairo meta.function.definition.cairo +foo source.cairo meta.function.definition.cairo entity.name.function.cairo +( source.cairo meta.function.definition.cairo punctuation.brackets.round.cairo +) source.cairo meta.function.definition.cairo punctuation.brackets.round.cairo +␣ source.cairo meta.function.definition.cairo +{ source.cairo meta.function.definition.cairo punctuation.brackets.curly.cairo +type source.cairo keyword.declaration.type.cairo storage.type.cairo +R source.cairo entity.name.type.declaration.cairo += source.cairo keyword.operator.assignment.equal.cairo +u8 source.cairo entity.name.type.numeric.cairo +; source.cairo punctuation.semi.cairo +} source.cairo punctuation.brackets.curly.cairo