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

Return EmittedDiagnostics in Session as a list of Diagnostic objects and not in human format #124

Open
ferranbt opened this issue Nov 14, 2024 · 0 comments
Labels
C-enhancement Category: an issue proposing an enhancement or a PR with one

Comments

@ferranbt
Copy link
Contributor

Describe the feature

Running this code:

let sess = Session::builder()
  .with_buffer_emitter(solar_interface::ColorChoice::Auto)
  .build();

let res = sess.enter(|| -> solar_interface::Result<()> {
  let mut pcx = solar_sema::ParsingContext::new(&sess);
  pcx.load_file(path).unwrap();
  pcx.parse_and_resolve()
});

sess.emitted_errors();

The function emitted_errors returns an EmittedDiagnostics object which is a human format representation of a list of Diagnostic objects.

I think the session object should not make the decision to return the errors in that specific format but return the Diagnostic objects itself and let the calling function decide how to format the result.

To give more colour to my use case, I was trying to write a debugger using solar and I need to format the diagnostics in a certain way.

Additional context

No response

@ferranbt ferranbt added C-enhancement Category: an issue proposing an enhancement or a PR with one S-needs-triage This issue needs to be labelled labels Nov 14, 2024
@onbjerg onbjerg removed the S-needs-triage This issue needs to be labelled label Nov 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-enhancement Category: an issue proposing an enhancement or a PR with one
Projects
None yet
Development

No branches or pull requests

2 participants