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(cli): improved diagnostics printing #22049

Merged
merged 4 commits into from
Jan 23, 2024
Merged

feat(cli): improved diagnostics printing #22049

merged 4 commits into from
Jan 23, 2024

Conversation

lucacasonato
Copy link
Member

@lucacasonato lucacasonato commented Jan 23, 2024

This initially uses the new diagnostic printer in deno lint,
deno doc and deno publish. In the limit we should also update
deno check to use this printer.

image

This initially uses the new diagnostic printer in `deno lint`,
`deno doc` and `deno publish`. In the limit we should also update
`deno check` to use this printer.
Copy link
Member

@bartlomieju bartlomieju left a comment

Choose a reason for hiding this comment

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

Looks great, a few nits and questions.

I think we should aim to rewrite TS diagnostics to use this system in the next patch release. Thoughts?

cli/tools/lint.rs Outdated Show resolved Hide resolved
/// Returns the text of the line that contains the given positions, split at the
/// given positions.
///
/// If the positions are on different lines, this will panic.
Copy link
Member

Choose a reason for hiding this comment

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

Is this okay? Maybe it should return an option and not panic?

Copy link
Member Author

Choose a reason for hiding this comment

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

The caller ensures they are on the same line already.

// error[missing-return-type]: missing explicit return type on public function
// at /mnt/artemis/Projects/github.com/denoland/deno/test.ts:1:16
// |
// 1 | export function test() {
Copy link
Member

Choose a reason for hiding this comment

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

Do you think in the future we could syntax highlight this code?

Copy link
Member Author

Choose a reason for hiding this comment

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

Absolutely!

@lucacasonato
Copy link
Member Author

I think we should aim to rewrite TS diagnostics to use this system in the next patch release. Thoughts?

Yeah, sounds good. It's a bit more involved because TS diagnostics can be "nested", so the printer needs to become a bit smarter. I attempted it briefly, but then realized that it would be too much work to do right away. I estimate 2-3 days of work to get it all perfect.

@lucacasonato lucacasonato merged commit 137f1a0 into main Jan 23, 2024
14 checks passed
@lucacasonato lucacasonato deleted the wip_diagnostics branch January 23, 2024 15:37
bartlomieju pushed a commit to bartlomieju/deno that referenced this pull request Jan 23, 2024
This initially uses the new diagnostic printer in `deno lint`,
`deno doc` and `deno publish`. In the limit we should also update
`deno check` to use this printer.
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.

2 participants