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

LSP panics when compiling Contracts with macro #4004

Closed
kobyhallx opened this issue Jan 10, 2024 · 0 comments
Closed

LSP panics when compiling Contracts with macro #4004

kobyhallx opened this issue Jan 10, 2024 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@kobyhallx
Copy link
Contributor

Aim

When opening noir source file in editor, LSP fails to start.

Expected Behavior

LSP starts normally allowing to see problems and/or use other lsp features.

Bug

LSP Panics with:

The local crate should be analyzed already

To Reproduce

  1. Clone and open aztec-starter
  2. Open main.nr
  3. Nor error information is provided, vscode reports error in notification box that lsp failed to start
    The Noir Language Server server crashed 5 times in the last 3 minutes. The server will not be restarted. See the output for more information.

Installation Method

Compiled from source

Nargo Version

cc3c2c2

Additional Context

No response

Would you like to submit a PR for this Issue?

Yes

Support Needs

No response

@kobyhallx kobyhallx added the bug Something isn't working label Jan 10, 2024
@github-project-automation github-project-automation bot moved this to 📋 Backlog in Noir Jan 10, 2024
@kobyhallx kobyhallx self-assigned this Jan 10, 2024
@kobyhallx kobyhallx moved this from 📋 Backlog to 🏗 In progress in Noir Jan 10, 2024
github-merge-queue bot pushed a commit that referenced this issue Jan 12, 2024
# Description

## Problem\*

Resolves <!-- Link to GitHub Issue -->

LSP panics when compiling Contracts with macro #4004

## Summary\*

While processing macro, we want to populate definitions instead of
returning early in case of error encountered by macro.

## Additional Context

LSP was crashing because definitions for crate were not populated when
macro error was encountered. Normally, we collect definitions and errors
are returned if encountered.

When macro is used, macro processor was returning early from collection
process and not allowing for definitions to be populated, therefore when
other parts were attempting to access collected defs , they were not
present where expected.

This PR fixes the problem by not returning early in collection process
when macro error is encountered and allowing definitions to be collected
therefore we populate crate definitions while retaining errors
encountered on the way.

## Documentation\*

Check one:
- [x] No documentation needed.
- [ ] Documentation included in this PR.
- [ ] **[Exceptional Case]** Documentation to be submitted in a separate
PR.

# PR Checklist\*

- [x] I have tested the changes locally.
- [x] I have formatted the changes with [Prettier](https://prettier.io/)
and/or `cargo fmt` on default settings.

---------

Co-authored-by: Tom French <tom@tomfren.ch>
Co-authored-by: kevaundray <kevtheappdev@gmail.com>
@github-project-automation github-project-automation bot moved this from 🏗 In progress to ✅ Done in Noir Apr 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Archived in project
Development

No branches or pull requests

2 participants