Skip to content

docs: Update the writing style guide with guidelines for diagnostics - #12770

Draft
0x6e wants to merge 1 commit into
masterfrom
nathan/diagnostics-style-guide
Draft

docs: Update the writing style guide with guidelines for diagnostics#12770
0x6e wants to merge 1 commit into
masterfrom
nathan/diagnostics-style-guide

Conversation

@0x6e

@0x6e 0x6e commented Aug 3, 2026

Copy link
Copy Markdown
Collaborator

After refactoring a bunch of code to adhere to these guidelines, it might be useful to make the public so that we can point others at them.

Very much a draft PR to aid discussion and give us a starting point.

@0x6e
0x6e requested review from LeonMatthes and ogoffart August 3, 2026 15:52
After refactoring a bunch of code to adhere to these guidelines, it
might be useful to make the public so that we can point others at them.
@ogoffart

ogoffart commented Aug 4, 2026

Copy link
Copy Markdown
Member

This makes sense to me.

Another thing that could be mention is that they shouldn't be ending with a period. (I think we even have a test for that)

@0x6e

0x6e commented Aug 4, 2026

Copy link
Copy Markdown
Collaborator Author

Is there a rationale I could add for that?

@ogoffart

ogoffart commented Aug 4, 2026

Copy link
Copy Markdown
Member

Is there a rationale I could add for that?

I did some archeology to find #275 (comment)
Not sure what the rationale is

@LeonMatthes LeonMatthes left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks for working ont his @0x6e

I added some points that still need discussing in my opinion.


1. Use the `Display` implementation for Rust types, if they exists.
- Rationale: The displayed text is generated from one location, keeping it consistent and allowing it to be updated easily.
2. Use single quotes around Slint syntax.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
2. Use single quotes around Slint syntax.
2. Use single quotes ( ' ) around Slint syntax.

nit: as a non-native speaker it's good to see the character visually to know which one we mean 😅 (' and not `)

Discussion point: Should we use ` instead? That might render nicely in some LSP implementations 🤔 )

1. Use the `Display` implementation for Rust types, if they exists.
- Rationale: The displayed text is generated from one location, keeping it consistent and allowing it to be updated easily.
2. Use single quotes around Slint syntax.
- Rationale: Emphasize the part of the diagnostic that either causes the error or provides a potential solution.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

For me that is the wrong rationale tbh.
The span should already point at the cause of the error.

IMO it is about distinguishing between prose and code. 🤔

But we could add two new points based on this:

  1. The diagnostic should span the smallest piece of code that is causing the issue. Use note diagnostics if the diagnostic is caused by multiple pieces of code.
    • Rationale: Emphasize the part of the code that causes the error and might need to be removed/changed to fix it
  2. Suggest solutions
    • Rationale: Many errors/warnings have common solutions. Suggest common solutions when possible, even if they are not always the correct solution.

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.

3 participants