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

eval: more robust way to extract comments from ParsedModule #4113

Merged
merged 1 commit into from
Mar 3, 2024

Conversation

jhrcek
Copy link
Collaborator

@jhrcek jhrcek commented Mar 3, 2024

Fixes #3500 and #3312

The problem in those issues can be illustrated by this simpler reproducer.
Peek 2024-03-03 13-47
The issue is that in the present of multi-line function definition, the "end of line comment" we want to extract for eval plugin is associated with the 2nd match group of function definition (confirmed this by compiling with -ddump-parsed-ast -dkeep-comments), which was part of AST that eval plugin was ignoring when extracting comments, thus it didn't create "Evaluate..." code lens.

By using biplate combinator from lens we can more simply extract all occurrences of LEpaComment from the parsed source, wherever they might be.

@jhrcek jhrcek marked this pull request as ready for review March 3, 2024 13:16
Copy link
Collaborator

@fendor fendor left a comment

Choose a reason for hiding this comment

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

LGTM :)

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

Successfully merging this pull request may close these issues.

Eval-plugin: Evaluate -- >>> does not work when there is one or more newlines at end of the file
2 participants