Skip to content

Conversation

@thomasmarshall
Copy link
Contributor

@thomasmarshall thomasmarshall commented Nov 28, 2025

Motivation

Closes #3775.

This PR fixes an issue whereby magic comments were not excluded when lazily loaded.

Implementation

I copied the implementation for eagerly loaded comments from here.

In order to do this, I needed the entries to have access to the magic_comment_regex configuration. I opted to pass the index through to the entries, but I'm not sure if that's the best approach—is it part of the public API that plugins use? I'm passing just the configuration through rather than the index.

Automated Tests

I have added a test and confirmed it failed before implementing the fix.

Manual Tests

  1. Add a magic comment above a constant
  2. Hover over a reference to that constant to see if the magic comment appears as documentation
Before After Real comments still appear
Screenshot 2025-11-28 at 16 48 06 Screenshot 2025-11-28 at 16 48 33 Screenshot 2025-11-28 at 16 49 07

@graphite-app
Copy link

graphite-app bot commented Nov 28, 2025

How to use the Graphite Merge Queue

Add the label graphite-merge to this PR to add it to the merge queue.

You must have a Graphite account in order to use the merge queue. Sign up using this link.

An organization admin has enabled the Graphite Merge Queue in this repository.

Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue.

This commit adds the index configuration to entries which will later be
used to fix an issue with magic comments appearing in documentation.
This commit ensures magic comments are excluded from documentation. They
were already filtered out when eagerly indexing comments but the same
logic wasn't applied when lazily loading comments.
@thomasmarshall thomasmarshall added the bugfix This PR will fix an existing bug label Nov 28, 2025
@thomasmarshall thomasmarshall marked this pull request as ready for review November 28, 2025 19:06
@thomasmarshall thomasmarshall requested a review from a team as a code owner November 28, 2025 19:06
Copy link
Member

@vinistock vinistock left a comment

Choose a reason for hiding this comment

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

Nice

module RubyIndexer
class Entry
#: Configuration
attr_reader :configuration
Copy link
Member

Choose a reason for hiding this comment

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

I think we're not using this attr_reader. If that's the case, let's remove it.

@alexcrocha alexcrocha added the server This pull request should be included in the server gem's release notes label Dec 1, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bugfix This PR will fix an existing bug server This pull request should be included in the server gem's release notes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Ignore "frozen_string_literal" pragma comments when indexing code documentation

3 participants