Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(lsp): Add nargo capabilities for test metadata #2532

Merged
merged 3 commits into from
Sep 13, 2023

Conversation

phated
Copy link
Contributor

@phated phated commented Sep 1, 2023

Description

Problem*

Resolves #2442

Summary*

This reworks types for the LSP to allow us to send back custom capabilities, such as

{
    "capabilities": {
        "codeLensProvider": {
            "resolveProvider": false
        },
        "nargo": {
            "tests": {
                "fetch": true,
                "run": true,
                "update": true
            }
        },
        "textDocumentSync": {
            "save": true
        }
    }
}

This also adds support for requesting metadata about tests, asking the LSP to run a test, and notifications for updating tests upon file save. These custom capabilities are in service of the Test Panel in vscode, but other LSP clients can decide not to implement them if they don't have testing APIs like vscode.

Documentation

  • This PR requires documentation updates when merged.

    • I will submit a noir-lang/docs PR.
    • I will request for and support Dev Rel's help in documenting this PR.

It's probably worth documenting the new UI elements that will be added to the vscode extension. I'll be including screenshots in the related PR that will be linked to this.

Additional Context

PR Checklist*

  • I have tested the changes locally.
  • I have formatted the changes with Prettier and/or cargo fmt on default settings.

crates/lsp/src/types.rs Outdated Show resolved Hide resolved
crates/lsp/src/types.rs Outdated Show resolved Hide resolved
crates/lsp/src/types.rs Outdated Show resolved Hide resolved
crates/lsp/src/lib.rs Outdated Show resolved Hide resolved
kevaundray
kevaundray previously approved these changes Sep 1, 2023
Copy link
Contributor

@kevaundray kevaundray left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left some nits

@TomAFrench
Copy link
Member

TomAFrench commented Sep 4, 2023

This fails for me if the Nargo workspace isn't at the root of the folder open in VSCode.

The issue stems from the extension only looking in the root for a Nargo.toml file and then failing to find it.

crates/lsp/src/lib.rs Outdated Show resolved Hide resolved
crates/lsp/src/lib.rs Outdated Show resolved Hide resolved
@phated
Copy link
Contributor Author

phated commented Sep 5, 2023

This fails for me if the Nargo workspace isn't at the root of the folder open in VSCode.
The issue stems from the extension only looking in the root for a Nargo.toml file and then failing to find it.

Yep, this is a limitation of our reliance on Nargo.toml and VSCode Testing API not working with file paths. I believe this is a limitation that this feature needs to accept without a much larger rework of finding the project root can happen.

@kevaundray kevaundray added this pull request to the merge queue Sep 13, 2023
Merged via the queue into master with commit b4ee23e Sep 13, 2023
16 checks passed
@kevaundray kevaundray deleted the phated/lsp-tests branch September 13, 2023 17:24
TomAFrench added a commit that referenced this pull request Sep 15, 2023
* master:
  chore: Add deprecation message for default type in for loop (#2689)
  chore!: Change `noir-lang/noir-source-resolver` to `noir-lang/source-resolver` (#2718)
  chore: clippy fixes (#2719)
  chore: Integrate noir.js into workspace and CI release workflow (#2705)
  feat: Add initial version of noir.js (#2681)
  chore: switch `release-source-resolver.yml` to use yarn (#2704)
  chore: move stranded test to correct directory (#2701)
  chore(ci): deny wildcard dependencies (#2702)
  chore: fix `noirc_abi_wasm` publish for release-please (#2699)
  chore: introduce workspace for js packages (#2677)
  feat: Allow methods defined in a contract to be non-entry points (#2687)
  chore: revert some unwanted small changes from PR2180 (#2685)
  feat(lsp): Add nargo capabilities for test metadata (#2532)
  chore(ci): Add `cargo deny` workflow (#2682)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

LSP: Custom message to provide test metadata
3 participants