Skip to content

Add @Example tag support to AutoLISP doc comments#271

Merged
qiuradsk merged 2 commits intomainfrom
wip/qiur/comment_example
Mar 13, 2026
Merged

Add @Example tag support to AutoLISP doc comments#271
qiuradsk merged 2 commits intomainfrom
wip/qiur/comment_example

Conversation

@qiuradsk
Copy link
Collaborator

Extends the comment parser, documentation presenter, and TextMate grammar to recognize @example tags with optional inline descriptions and fenced code blocks. Multiple @example entries per docstring are supported, and @ signs inside code fences are not misinterpreted as tags. Adds unit tests for parsing and hover-markdown rendering.

Objective

#267

Abstractions
Tests performed

verified @example tag in comment for function previews:

  • One-liner
  • Multiple lines code block with "```" fence
  • Multiple lines code block without "```" fence
Screen shot
image

Extends the comment parser, documentation presenter, and TextMate grammar to recognise @example tags with optional inline descriptions and fenced code blocks. Multiple @example entries per docstring are supported, and @ signs inside code fences are not misinterpreted as tags. Adds unit tests for parsing and hover-markdown rendering.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR extends AutoLISP doc comment support to include @Example tags, so that examples (including fenced code blocks) can be parsed from docstrings and rendered in hover/tooltips, while also updating the TextMate grammar to highlight the new tag.

Changes:

  • Extend doc comment parsing to support multiple @Example entries and ignore @ tag parsing inside fenced example blocks.
  • Render @Example sections in hover markdown, including normalizing fenced blocks to use the autolisp language id.
  • Update TextMate grammar + add unit tests for parsing and hover markdown rendering.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
extension/syntaxes/autolisp.tmLanguage.json Adds @EXAMPLE/@EXAMPLES to comment-block tag highlighting.
extension/src/parsing/comments.ts Parses @Example sections (multiple entries) and tracks fenced blocks to avoid mis-parsing @ inside code.
extension/src/help/documentationPresenter.ts Renders examples into hover markdown, injecting/normalizing autolisp fenced blocks.
extension/src/test/suite/parsing.comments.test.ts Adds parsing coverage for inline description, fences, multiple examples, and @ inside fences.
extension/src/test/suite/providers.hoverProvider.test.ts Adds hover-markdown verification for one-line examples and fenced examples.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

The previous implementation stripped leading |/; characters from all
example lines, which incorrectly removed semicolons from valid AutoLISP
comment lines inside @example blocks (e.g. "; this is a comment").

Those characters were only needed to handle ;| / |; delimiter lines,
but those lines always normalize to empty via normalizeComment() and
are skipped before normalizeExampleLine() is ever called for value
accumulation — making the stripping branch unreachable dead code.

Simplified to only strip up to 4 spaces of block-comment indentation,
preserving all content characters including ; and |.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@qiuradsk qiuradsk merged commit 74f59ee into main Mar 13, 2026
6 of 7 checks passed
@qiuradsk qiuradsk deleted the wip/qiur/comment_example branch March 13, 2026 07:26
@github-actions github-actions bot locked and limited conversation to collaborators Mar 13, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants