Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect span for mulitline doc comment #277

Closed
ReeceHumphreys opened this issue Sep 26, 2022 · 2 comments · Fixed by #303
Closed

Incorrect span for mulitline doc comment #277

ReeceHumphreys opened this issue Sep 26, 2022 · 2 comments · Fixed by #303
Assignees
Labels
bug Something isn't working

Comments

@ReeceHumphreys
Copy link
Contributor

The end Location for multiline doc comments seems incorrect by a few characters. This results in the underlining of multiline doc comments when reporting error/warning locations are slightly off.

Sample output :

warning [W001]: doc comment has a param tag for 'x', but there is no parameter by that name
 --> test_slice/foo.slice:4:5
    |
4   |     /// @param x this is a x
5   |     /// @param y this is a y
    |     ---------------------------- <---- too long
    |

Slice to reproduce:

module  Foo;

interface I {
    /// @param x this is a x
    /// @param y this is a y
    op(y: int32, z: int32, a: int32);
}
@ReeceHumphreys ReeceHumphreys added the bug Something isn't working label Sep 26, 2022
@InsertCreativityHere
Copy link
Member

InsertCreativityHere commented Sep 26, 2022

This comment is incorrect

I suspect this is really just another facet of #240.
We don't keep spans for each line of a comment separately, there is 1 span for the entire comment.
If the comment is multiple lines (like here), it will have all the same issues other multi-line comments have.

@InsertCreativityHere
Copy link
Member

You're right, this is unrelated. Pest greedily consume whitespace in some places, so with doc comments, it's incorrectly matching the newline and leading whitespace on the next line as part of the doc comment.

I'm going to ignore it for now. It should be fixed in my new parser.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants