Include comments when dispatching listener events
Nobody has claimed this yet.
- Dominant language
- Ruby
- Stars
- 2k
- Forks
- 281
- Avg merge
- 2h 14m
- Merged PRs (30d)
- 6
Description
There are scenarios where addons might need to have access to comments that are close to nodes they are interested in.
For example, for RBS inline annotations, an addon could provide completion, go to definition, hover and semantic highlighting. But currently, the listeners cannot receive any comments content, because the comments are separate from the AST in Prism's parse result.
I believe the easiest way to provide this functionality to listeners might be to create a custom dispatcher that stores the comment information and passes that along to listeners in a way that allows them to easily access it.
Scenario: imagine proper highlighting and the ability to navigate through constants in these inline RBS annotations.
class Foo
attr_reader :name # ::String
# :: (String, Integer?) -> void
def bar(a, b)
end
end
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing how Prism's parse result is converted into listener dispatch, focusing on where comments are separated from the AST. Determine how nearby comment content could be exposed to listeners for inline RBS annotations. Done means listeners can access relevant comments while processing nodes, with coverage for the Ruby example described in the issue.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- ruby
- Domain
- devtools
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100