Add support for Rails Annotations and CodeStatistics#206
Merged
januszm merged 1 commit intoslim-template:masterfrom Dec 11, 2025
Merged
Add support for Rails Annotations and CodeStatistics#206januszm merged 1 commit intoslim-template:masterfrom
januszm merged 1 commit intoslim-template:masterfrom
Conversation
Collaborator
Author
|
I opened the Issue (#207) because I encountered a situation where the slim-rails version was downgraded during local testing this feature. |
januszm
approved these changes
Dec 10, 2025
73ee3f9 to
255bf5a
Compare
Collaborator
Author
|
I have rebased to add CI for Rails 8.1. |
januszm
approved these changes
Dec 11, 2025
Collaborator
Author
|
Thank you for reviewing. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This Pull Request adds support for Rails Annotations and CodeStatistics.
Annotations
This Pull Request enables the
rails notescommand recognizeTODOcomments inside.slimfiles.Expected behavior
Annotations inside
.slimfiles are detected.$ rails notes * [ 3] [TODO] some commentActual behavior
Annotations inside
.slimfiles are not detected.Details
Below is an example from Rails that shows how additional extensions can be registered for annotations:
CodeStatistics
This change enables
.slimfiles to be counted by therails statscommand.Rails 8.2 (main branch) introduced a new method,
Rails::CodeStatistics#register_extension, which allows gems to register additional file extensions.When running on Rails 8.2 or later, this Pull Request registers the slim extension with
Rails::CodeStatistics.Rails::CodeStatistics#register_extensionto register file extensions forrails statsrails/rails#56017For reference, here is an example of how to register an extension: