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

Diagnostic formatter should highlight trivia in between consecutive highlight nodes #2208

Open
ahoppen opened this issue Sep 16, 2023 · 6 comments · May be fixed by #2242
Open

Diagnostic formatter should highlight trivia in between consecutive highlight nodes #2208

ahoppen opened this issue Sep 16, 2023 · 6 comments · May be fixed by #2242
Assignees
Labels
enhancement New feature or request

Comments

@ahoppen
Copy link
Member

ahoppen commented Sep 16, 2023

Currently, if a diagnostic has two nodes to highlight, it will highlight them individually, leaving the trivia in between them non-highlighted. The easiest way to see this is by running

swift-parser-cli print-diags -s 'for x = 1; x < 10; x++ {}'
Screenshot 2023-09-16 at 09 14 02

Note that the space between x and = should also be highlighted.

@ahoppen ahoppen added the enhancement New feature or request label Sep 16, 2023
@ahoppen
Copy link
Member Author

ahoppen commented Sep 16, 2023

Tracked in Apple’s issue tracker as rdar://115600611

@Matejkob
Copy link
Contributor

I'm on it

@Matejkob
Copy link
Contributor

I've implemented a solution to this issue and now I'd like to add unit tests to ensure that all edge cases are covered. Do we have a straightforward way to create Diagnostic.highlights efficiently in unit tests and attach them to a given syntax tree? I couldn't find anything like that in the codebase.

@ahoppen
Copy link
Member Author

ahoppen commented Sep 26, 2023

I don’t think there is. This comment that I posted just now might be relevant.

@Matejkob
Copy link
Contributor

This comment that I posted just now might be relevant.

Pardon? 😅

@ahoppen
Copy link
Member Author

ahoppen commented Sep 26, 2023

Forgot to add the link: #2238 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants