feat: add Ranges to GoComment parser nodes#1225
Merged
Conversation
a-h
requested changes
Jul 26, 2025
Owner
a-h
left a comment
There was a problem hiding this comment.
Looks good, just a minor nit if you don't mind, then happy to merge.
A number of small PRs would be preferable to a big one.
| Contents: " single line comment", | ||
| Multiline: false, | ||
| Range: Range{ | ||
| To: Position{Index: 22, Line: 0, Col: 22}, |
Owner
There was a problem hiding this comment.
I know that the From value is a zero value, but I think it would be clearer if From: Position{Index: 0, Line: 0, Col: 0}, was visible.
Contributor
Author
There was a problem hiding this comment.
Agreed! Thank you for updating and merging. I will be sure to do this for future PRs.
This was referenced Nov 14, 2025
This was referenced Feb 10, 2026
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.
Hi there, I'm working on a Templ Linting tool for my project. In order to (a) display useful results to users and (b) enable linter config via comments (similar to eslint's
eslint-disable), the tool needs to be able to understand the original source location of parsed nodes.I came across a discussion thread on this topic and @joerdav seemed to agree that Templ's own parser should be able to support this: #586
So, here I am with what I hope to be the first of a handful of pull requests to add
Ranges to various parser nodes. I kept this one small to ensure that I'm following the right conventions, etc. Happy to receive feedback on the PR. I would like to make future PRs a bit longer so I'm not bombarding you with them, but if you prefer many smaller changes that'd fine with me.Thanks for taking a look!