Skip to content

Add a note about @sample in KDocs - #2171

Merged
AndreiKingsley merged 2 commits into
masterfrom
samples_in_kdocs
Oct 20, 2026
Merged

AndreiKingsley merged 2 commits into
masterfrom
samples_in_kdocs

Conversation

@AndreiKingsley

Copy link
Copy Markdown
Collaborator

No description provided.

@jetbrains-air jetbrains-air Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks for writing this down — just one broken reference to fix before merge.


Produced by Air Automations. Name: AI Review / Run: d89b972f

Comment thread KDOC_GUIDELINES.md Resolved

@jetbrains-air jetbrains-air Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Nice, useful guidance — just one link that needs sorting out before this can land. 🙂

Produced by Air Automations. Name: AI Review / Run: https://air.jetbrains.cloud/org/05cf1a7f-6ab5-713b-abd3-29d0c8a05e2d/automations/8daf2412-0b6c-4433-90c0-b40ab5aebcdb?run=df653dd4-791a-4382-8b33-798a080254e9

Comment thread KDOC_GUIDELINES.md Resolved
Comment thread KDOC_GUIDELINES.md

Do not write examples as literal ` ```kotlin ` blocks in a KDoc. Write each example as a passing test in the
[`:samples`](samples) module and include it with the KoDEx
[`@sample`](KODEX_KDOC_PREPROCESSING.md#sample-and-samplenocomments-including-code-samples) notation.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

important to note that you need to write the fully qualified name, because it's impossible to import from :samples inside other modules.

Comment thread KODEX_KDOC_PREPROCESSING.md Outdated
@@ -327,8 +327,9 @@ only the code between these markers will be included in the KDoc.

Gradle resolves `@sample` references into the `:samples` module, which is added as a contextual source, but the
IntelliJ KoDEx plugin does not: the IDE hover then shows a `SampleDocProcessor` error instead of the KDoc.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

"error instead of the KDoc" is now fixed to "error where the sample would be", the rest of the kdoc is fine :)

@AndreiKingsley
AndreiKingsley merged commit ad44a90 into master Oct 20, 2026
3 checks passed
@AndreiKingsley
AndreiKingsley deleted the samples_in_kdocs branch October 20, 2026 14:33
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